Skip to content

Commit 731efc9

Browse files
committed
Made a bit more sense of exceptions with inheritance
1 parent b8b2a33 commit 731efc9

1 file changed

Lines changed: 13 additions & 33 deletions

File tree

ebaysdk/exception.py

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,26 @@
66
Licensed under CDDL 1.0
77
'''
88

9-
class ConnectionError(Exception):
10-
def __init__(self, msg, response):
11-
super(ConnectionError, self).__init__(u'%s' % msg)
9+
class EbaySDKError(StandardError):
10+
def __init__(self, msg, response=None):
11+
super(EbaySDKError, self).__init__(u'%s' % msg)
1212
self.message = u'%s' % msg
1313
self.response = response
1414

1515
def __str__(self):
1616
return repr(self.message)
1717

18-
class ConnectionConfigError(Exception):
19-
def __init__(self, msg):
20-
super(ConnectionConfigError, self).__init__(u'%s' % msg)
21-
self.message = u'%s' % msg
22-
23-
def __str__(self):
24-
return repr(self.message)
25-
26-
class ConnectionResponseError(Exception):
27-
def __init__(self, msg, response):
28-
super(ConnectionResponseError, self).__init__(u'%s' % msg)
29-
self.message = u'%s' % msg
30-
self.response = response
31-
32-
def __str__(self):
33-
return repr(self.message)
18+
class ConnectionError(EbaySDKError):
19+
pass
3420

35-
class RequestPaginationError(Exception):
36-
def __init__(self, msg, response):
37-
super(RequestPaginationError, self).__init__(u'%s' % msg)
38-
self.message = u'%s' % msg
39-
self.response = response
21+
class ConnectionConfigError(EbaySDKError):
22+
pass
4023

41-
def __str__(self):
42-
return repr(self.message)
24+
class ConnectionResponseError(EbaySDKError):
25+
pass
4326

44-
class PaginationLimit(Exception):
45-
def __init__(self, msg, response):
46-
super(PaginationLimit, self).__init__(u'%s' % msg)
47-
self.message = u'%s' % msg
48-
self.response = response
27+
class RequestPaginationError(EbaySDKError):
28+
pass
4929

50-
def __str__(self):
51-
return repr(self.message)
30+
class PaginationLimit(EbaySDKError):
31+
pass

0 commit comments

Comments
 (0)