Skip to content

Commit 5bc3d5d

Browse files
committed
Updated the python SDK exceptions to match that of the other SDKs.
1 parent e049134 commit 5bc3d5d

29 files changed

+91
-82
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,4 @@ located in [test](/tests)
137137

138138
## Exceptions
139139
The SDK can raise multiple exceptions. For an overview of these exceptions please
140-
take a look at [EXCEPTIONS.md](./EXCEPTIONS.md)
140+
take a look at [EXCEPTIONS.md](./bunq/sdk/exception/EXCEPTIONS.md)

bunq/sdk/context/api_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from bunq.sdk.context.api_environment_type import ApiEnvironmentType
66
from bunq.sdk.context.installation_context import InstallationContext
77
from bunq.sdk.context.session_context import SessionContext
8-
from bunq.sdk.exception.exception import BunqException
8+
from bunq.sdk.exception.bunq_exception import BunqException
99
from bunq.sdk.json import converter
1010
from bunq.sdk.model import core
1111
from bunq.sdk.model.generated import endpoint

bunq/sdk/context/bunq_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from bunq.sdk.context.api_context import ApiContext
22
from bunq.sdk.context.user_context import UserContext
3-
from bunq.sdk.exception.exception import BunqException
3+
from bunq.sdk.exception.bunq_exception import BunqException
44

55

66
class BunqContext(object):

bunq/sdk/context/user_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from bunq.sdk.exception.exception import BunqException
1+
from bunq.sdk.exception.bunq_exception import BunqException
22
from bunq.sdk.model import core
33
from bunq.sdk.model.generated import endpoint
44

EXCEPTIONS.md renamed to bunq/sdk/exception/EXCEPTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Because we raise different exceptions for each error, you can catch an error
5353
if you expect it to be raised.
5454

5555
```python
56-
from bunq.sdk.exception.exception import BadRequestException
56+
from bunq.sdk.exception.bad_request_exception import BadRequestException
5757
from bunq.sdk.context.api_context import ApiEnvironmentType, ApiContext
5858

5959
API_KEY = "Some invalid API key"

bunq/sdk/exception/exception.py renamed to bunq/sdk/exception/api_exception.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,3 @@ def response_id(self):
3535
"""
3636

3737
return self._response_id
38-
39-
40-
class BunqException(Exception):
41-
def __init__(self, message):
42-
super(BunqException, self).__init__(message)
43-
44-
45-
class UnknownApiErrorException(ApiException):
46-
pass
47-
48-
49-
class BadRequestException(ApiException):
50-
pass
51-
52-
53-
class UnauthorizedException(ApiException):
54-
pass
55-
56-
57-
class ForbiddenException(ApiException):
58-
pass
59-
60-
61-
class NotFoundException(ApiException):
62-
pass
63-
64-
65-
class MethodNotAllowedException(ApiException):
66-
pass
67-
68-
69-
class TooManyRequestsException(ApiException):
70-
pass
71-
72-
73-
class PleaseContactBunqException(ApiException):
74-
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from bunq.sdk.exception.api_exception import ApiException
2+
3+
4+
class BadRequestException(ApiException):
5+
pass

bunq/sdk/exception/bunq_exception.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class BunqException(Exception):
2+
def __init__(self, message):
3+
super(BunqException, self).__init__(message)

bunq/sdk/exception/exception_factory.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
from bunq.sdk.exception.exception import BadRequestException
2-
from bunq.sdk.exception.exception import UnauthorizedException
3-
from bunq.sdk.exception.exception import ForbiddenException
4-
from bunq.sdk.exception.exception import NotFoundException
5-
from bunq.sdk.exception.exception import MethodNotAllowedException
6-
from bunq.sdk.exception.exception import TooManyRequestsException
7-
from bunq.sdk.exception.exception import PleaseContactBunqException
8-
from bunq.sdk.exception.exception import UnknownApiErrorException
9-
from bunq.sdk.exception.exception import ApiException
1+
from bunq.sdk.exception.bad_request_exception import BadRequestException
2+
from bunq.sdk.exception.forbidden_exception import ForbiddenException
3+
from bunq.sdk.exception.method_not_allowed_exception import MethodNotAllowedException
4+
from bunq.sdk.exception.not_found_exception import NotFoundException
5+
from bunq.sdk.exception.please_contact_bunq_exception import PleaseContactBunqException
6+
from bunq.sdk.exception.too_many_requests_exception import TooManyRequestsException
7+
from bunq.sdk.exception.unauthorized_exception import UnauthorizedException
8+
from bunq.sdk.exception.unknown_api_error_exception import UnknownApiErrorException
109

1110

1211
class ExceptionFactory:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from bunq.sdk.exception.api_exception import ApiException
2+
3+
4+
class ForbiddenException(ApiException):
5+
pass

0 commit comments

Comments
 (0)