@@ -21,7 +21,10 @@ class ExceptionFactory:
21
21
22
22
# Constants for formatting messages
23
23
_FORMAT_RESPONSE_CODE_LINE = 'HTTP Response Code: {}'
24
- _GLUE_ERROR_MESSAGES = '\n '
24
+ _FORMAT_RESPONSE_ID_LINE = 'The response id to help bunq debug: {}'
25
+ _FORMAT_ERROR_MESSAGE_LINE = 'Error message: {}'
26
+ _GLUE_ERROR_MESSAGES_NEW_LINE = '\n '
27
+ _GLUE_ERROR_MESSAGES_STRING_EMPTY = ''
25
28
26
29
@classmethod
27
30
def create_exception_for_response (cls , response_code , messages ):
@@ -53,8 +56,9 @@ def create_exception_for_response(cls, response_code, messages):
53
56
return UnknownApiErrorException (error_message , response_code )
54
57
55
58
@classmethod
56
- def _generate_message_error (cls , response_code , messages ):
59
+ def _generate_message_error (cls , response_code , messages , response_id ):
57
60
"""
61
+ :type response_id: str
58
62
:type response_code: int
59
63
:type messages: list[str]
60
64
@@ -63,8 +67,14 @@ def _generate_message_error(cls, response_code, messages):
63
67
64
68
line_response_code = cls ._FORMAT_RESPONSE_CODE_LINE \
65
69
.format (response_code )
70
+ line_response_id = cls ._FORMAT_RESPONSE_ID_LINE .format (response_id )
71
+ line_error_message = cls ._FORMAT_ERROR_MESSAGE_LINE .format (
72
+ cls ._GLUE_ERROR_MESSAGES_STRING_EMPTY .join (messages )
73
+ )
66
74
67
- return cls ._glue_messages ([line_response_code ] + messages )
75
+ return cls ._glue_messages (
76
+ [line_response_code , line_response_id , line_error_message ]
77
+ )
68
78
69
79
@classmethod
70
80
def _glue_messages (cls , messages ):
@@ -74,4 +84,4 @@ def _glue_messages(cls, messages):
74
84
:rtype: str
75
85
"""
76
86
77
- return cls ._GLUE_ERROR_MESSAGES .join (messages )
87
+ return cls ._GLUE_ERROR_MESSAGES_NEW_LINE .join (messages )
0 commit comments