Skip to content

Commit

Permalink
Improve diff error message
Browse files Browse the repository at this point in the history
  • Loading branch information
alstr committed Dec 6, 2024
1 parent 3ac81cb commit edf5d49
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion GitHubClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit edf5d49

Please sign in to comment.