Skip to content

Increase visibility of error message when action fails due to HTTP request error #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 23, 2024
Merged

Increase visibility of error message when action fails due to HTTP request error #81

merged 3 commits into from
Jan 23, 2024

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Jan 23, 2024

The arduino/report-size-deltas action relies on the GitHub REST API. It makes HTTP requests to various API endpoints during each workflow run.

These requests might produce an exception due to transient network outages, misconfiguration of the workflow, or a problem with the action. This will cause the action's step in the workflow run to fail. The maintainer of the repository in which the action is used may then need to investigate the cause of the failure.

Previously, the cause of the failure could only be determined by evaluating the workflow run logs, which are somewhat unfriendly due to containing the Python stack trace produced by the HTTP request exception. The significant error message is here made visible as an annotation on the workflow run summary page through the use of an "error" workflow command:

image

The "arduino/report-size-deltas" action relies on the GitHub REST API. It makes HTTP requests to various API endpoints
during each workflow run.

It is expected that these requests might occasionally produce an exception due to transient network outages. For this
reason, the action has special handling of exceptions. Previously, that exception handling code was configured to be
triggered on any exception, even though it is specific to HTTP request errors. It is more appropriate to target it only
to the specific urllib.error.HTTPError exception that results from an HTTP request error, leaving any other types of
unexpected exceptions unhandled.
…quest error

The "arduino/report-size-deltas" action relies on the GitHub REST API. It makes HTTP requests to various API endpoints
during each workflow run.

These requests might produce an exception due to transient network outages, misconfiguration of the workflow, or a
problem with the action. This will cause the action's step in the workflow run to fail. The maintainer of the repository
in which the action is used may then need to investigate the cause of the failure.

Previously, the cause of the failure could only be determined by evaluating the workflow run logs, which are somewhat
unfriendly due to containing the Python stack trace produced by the HTTP request exception. The significant error
message is hereby made visible as an annotation on the workflow run summary page through the use of an "error" workflow
command.
By default, pytest captures all output from the code during test execution. For unknown reasons, the creator of the
original pytest configuration file which was reused for this project decided to disable that behavior. This resulted in
any output from the code under test being shown in the test logs, making them very difficult to read and interpret.

That configuration is hereby removed. After this change, script output from successful test runs will not be shown in
the test logs. Since the output might be useful for troubleshooting test failures, it will be shown when a test fails,
in a special section of the logs.
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jan 23, 2024
@per1234 per1234 self-assigned this Jan 23, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e9c0345) 100.00% compared to head (0149266) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #81   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          740       745    +5     
=========================================
+ Hits           740       745    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@per1234 per1234 merged commit 8a0046b into arduino:main Jan 23, 2024
@per1234 per1234 deleted the improve-http-error-messages branch January 23, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants