Skip to content

Commit e5f59a8

Browse files
committed
fix python exception issues
1 parent 23cf05f commit e5f59a8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

templates/python/package/client.py.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class Client:
8686

8787
return response._content
8888
except Exception as e:
89-
if e.response:
90-
raise {{spec.title | caseUcfirst}}Exception(e.response.json()['message'], e.response.status_code, e.response.json())
89+
if response.json():
90+
raise {{spec.title | caseUcfirst}}Exception(response.json()['message'], response.status_code, response.json())
9191
else:
9292
raise {{spec.title | caseUcfirst}}Exception(e)
9393

templates/python/package/exception.py.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class {{spec.title | caseUcfirst}}Exception(Exception):
2-
def __init__(self, message, code, response):
2+
def __init__(self, message, code = 0, response = None):
33
self.message = message
44
self.code = code
55
self.response = response

0 commit comments

Comments
 (0)