-
Notifications
You must be signed in to change notification settings - Fork 76
/
exceptions.py
47 lines (34 loc) · 1.23 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
:class:`NetSuiteError`
:class:`NetSuiteLoginError`
:class:`NetSuiteRequestError`
:class:`NetSuiteTypeError`
:class:`NetSuiteRateLimitError`
"""
class NetSuiteError(Exception):
"""Exception raised for errors during login or other requests (like
get, getAll) to NetSuite."""
def __init__(self, message, code=None):
"""
:param str message: Text describing the error
:param str code: Netsuite code specifying the exact error
Possible values are listed in
"""
self.message = message
self.code = code
def __str__(self):
if self.code is None:
return self.message
return 'code: {}, message: {}'.format(self.code, self.message)
class NetSuiteLoginError(NetSuiteError):
"""Exception raised for errors during login to NetSuite"""
pass
class NetSuiteRequestError(NetSuiteError):
"""Exception raised for errors during requests like get, search, .."""
pass
class NetSuiteTypeError(NetSuiteError):
"""Exception raised when requested an invalid netsuite type"""
pass
class NetSuiteRateLimitError(NetSuiteError):
"""Exception raised for errors during rate limit requests like get, search, .."""
pass