Skip to content

Commit 46d5e31

Browse files
committed
fix: Exception cause processing
1 parent d6db528 commit 46d5e31

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [5.0.1] - 2022-12-21
8+
### Fixed
9+
* Error when processing some exceptions
10+
711
## [5.0.0] - 2022-12-02
812
### Added
913
* `DevoClientException` and `DevoSenderException` refactored for better details extraction

devo/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__description__ = 'Devo Python Library.'
22
__url__ = 'http://www.devo.com'
3-
__version__ = "5.0.0"
3+
__version__ = "5.0.1"
44
__author__ = 'Devo'
55
__author_email__ = '[email protected]'
66
__license__ = 'MIT'

devo/api/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def _format_error(error, status):
104104
"msg": error.get("msg", "Error Launching Query"),
105105
"cause": error.get("object") or error.get("context") or error
106106
}
107+
# 'object' may be a list
108+
if isinstance(response["cause"], list):
109+
response["cause"] = ": ".join(response["cause"])
107110
if status:
108111
response['status'] = status
109112
elif 'status' in error:

tests/api/test_errors.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ def test_error_ALL_1(self):
5757
self.assertEqual(1669737806151,
5858
context.exception.timestamp)
5959
self.assertIsNone(context.exception.code)
60-
self.assertEqual(['Error Launching Query',
60+
self.assertEqual('Error Launching Query: '
6161
'com.devo.malote.syntax.ParseException: Encountered'
6262
' " "not" "not "" at line 1, column 17.\nWas'
6363
' expecting one of:\n <ID> ...\n <QID> ...\n'
64-
' '],
64+
' ',
6565
context.exception.cause)
66-
self.assertEqual({'cause': ['Error Launching Query',
67-
'com.devo.malote.syntax.ParseException:'
68-
' Encountered " "not" "not "" at line 1,'
69-
' column 17.\nWas expecting one of:\n'
70-
' <ID> ...\n <QID> ...\n '],
66+
self.assertEqual({'cause': 'Error Launching Query: '
67+
'com.devo.malote.syntax.ParseException:'
68+
' Encountered " "not" "not "" at line 1,'
69+
' column 17.\nWas expecting one of:\n'
70+
' <ID> ...\n <QID> ...\n ',
7171
'msg': 'Error Launching Query',
7272
'cid': 'b46bde339628',
7373
'msg': 'Error Launching Query',

0 commit comments

Comments
 (0)