Skip to content

Commit cfdd181

Browse files
authored
Add response content to ApiException class (#83)
1 parent d9c857f commit cfdd181

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

staxapp/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class ApiException(Exception):
66
def __init__(self, message, response, detail=""):
77
try:
88
self.status_code = response.status_code
9+
self.response = response.json()
910
if response.json().get("Error"):
1011
logging.error(f"{response.status_code}: {response.json()}")
1112
self.message = f"Api Exception: {response.status_code} -{detail} {response.json()['Error']}"
@@ -15,6 +16,7 @@ def __init__(self, message, response, detail=""):
1516
except:
1617
if response.content:
1718
logging.error(f"{response.status_code}: {response.content}")
19+
self.response = response.content
1820
else:
1921
logging.error(f"{response.status_code}: {message}")
2022
self.message = f"Api Exception:{detail} {message}"

0 commit comments

Comments
 (0)