From edf5d49a3c2ab66321fe441211657475c7956890 Mon Sep 17 00:00:00 2001 From: alstr Date: Fri, 6 Dec 2024 18:22:26 +0000 Subject: [PATCH] Improve diff error message --- GitHubClient.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GitHubClient.py b/GitHubClient.py index 7ea5b87..a814075 100644 --- a/GitHubClient.py +++ b/GitHubClient.py @@ -87,7 +87,14 @@ def get_last_diff(self): diff_request = requests.get(url=diff_url, headers=diff_headers) if diff_request.status_code == 200: return diff_request.text - raise Exception('Could not retrieve diff. Operation will abort.') + + error_response = [f'Could not retrieve diff', + f'URL: {diff_url}', + f'Status code: {diff_request.status_code}'] + if 'application/json' in diff_request.headers['content-type']: + error_response.append(f'Server response: {json.loads(diff_request.text)['message']}') + error_response.append('Operation will abort') + raise Exception('\n'.join(error_response)) # noinspection PyMethodMayBeStatic def _get_timestamp(self, commit):