Skip to content

Commit

Permalink
Update ClientError and ServerError methods
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisT-CM committed Jan 22, 2025
1 parent ae2a07f commit a78ecbe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/createsend/createsend.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,11 @@ def handle_response(self, status, data):
elif status == 404:
raise NotFound()
elif status in range(400, 500):
raise ClientError()
json_data = json_to_py(data)
raise ClientError(f"Code: {json_data.Code} {json_data.Message}")
elif status in range(500, 600):
raise ServerError()
json_data = json_to_py(data)
raise ServerError(f"Code: {json_data.Code} {json_data.Message}")
return data

def _get(self, path, params={}, username=None, password=None):
Expand Down

0 comments on commit a78ecbe

Please sign in to comment.