Skip to content

Commit 7b0b329

Browse files
author
Kevin Hellemun
committed
Some cleaning 👏.
1 parent 3953773 commit 7b0b329

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

bunq/sdk/client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,6 @@ def _assert_response_success(self, response):
208208
)
209209

210210
raise exception_
211-
# raise exception.ApiException(
212-
# response.status_code,
213-
# self._fetch_error_messages(response)
214-
# )
215211

216212
@classmethod
217213
def _create_bunq_response_raw(cls, response):

bunq/sdk/exception.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
class BunqError(Exception):
22
def __init__(self, message, response_code):
3+
"""
4+
:type message: str
5+
:type response_code: int
6+
"""
7+
38
self._response_code = response_code
49
self._message = message
510

611
super(BunqError, self).__init__(message)
712

813
@property
914
def message(self):
15+
"""
16+
:rtype: str
17+
"""
18+
1019
return self._message
1120

1221
@property
1322
def response_code(self):
23+
"""
24+
:rtype: int
25+
"""
26+
1427
return self._response_code
1528

1629

bunq/sdk/exception_hanlder.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from bunq.sdk.exception import ToManyRequestsException
77
from bunq.sdk.exception import PleaseContactBunqException
88
from bunq.sdk.exception import ApiException
9+
from bunq.sdk.exception import BunqError
910

1011

1112
class ExceptionHandler(Exception):
@@ -24,6 +25,14 @@ class ExceptionHandler(Exception):
2425

2526
@classmethod
2627
def create_exception_for_response(cls, response_code, messages):
28+
"""
29+
:type response_code: int
30+
:type messages: list[str]
31+
32+
:return: The exception according to the status code.
33+
:rtype: BunqError
34+
"""
35+
2736
error_message = cls._generate_message_error(response_code, messages)
2837

2938
if response_code == cls._HTTP_RESPONSE_CODE_BAD_REQUEST:

0 commit comments

Comments
 (0)