Skip to content

Commit

Permalink
Change: Improve error message for http errors while running GitHub sc…
Browse files Browse the repository at this point in the history
…ript

Print more details about the request and running script when a http
error occurs. This allows for better analysis of the cause of the error.
  • Loading branch information
bjoernricks committed Jul 6, 2023
1 parent d1a2118 commit d2667b1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pontos/github/script/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ def main():
try:
error = e.response.json()
message = error.get("message")
print("Error:", message, file=sys.stderr)
print(
f"HTTP error while running script {known_args.script} and "
f"doing a {e.request.method} request to {e.request.url}. "
f"Error was: {message}. ",
file=sys.stderr,
)
except json.JSONDecodeError:
# not a json response
print(e, file=sys.stderr)
Expand Down

0 comments on commit d2667b1

Please sign in to comment.