From a78ecbe9ceec76a89a9b56ae33a8e687304f66ad Mon Sep 17 00:00:00 2001 From: AlexisLikesTea Date: Wed, 22 Jan 2025 12:08:17 +1100 Subject: [PATCH] Update ClientError and ServerError methods --- lib/createsend/createsend.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/createsend/createsend.py b/lib/createsend/createsend.py index 6e749dd..b1156dd 100644 --- a/lib/createsend/createsend.py +++ b/lib/createsend/createsend.py @@ -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):