Skip to content
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

fix: SubsidyAPIHTTPError should not drop the HTTP response error #391

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

pwnage101
Copy link
Contributor

Before this change, the SubsidyAPIHTTPError source code assumed that we can test the truthiness of requests.models.Response as a proxy for existence. This is a fatal assumption because the Response objects overrides bool() in a way that all error codes are falsey. This resulted in completely dropping the error information from the response object.

After this change, error codes will actually be propagated up into error logging tools (New Relic, Splunk, etc.).

requests.models.Response implementation: https://docs.python-requests.org/en/latest/_modules/requests/models/#Response

@pwnage101 pwnage101 force-pushed the pwnage101/fix-subsidy-api-error-logging branch from cbc248c to 86b23e2 Compare January 30, 2024 22:59
Before this change, the SubsidyAPIHTTPError source code assumed that we
can test the truthiness of requests.models.Response as a proxy for
existence.  This is a fatal assumption because the Response objects
overrides __bool__() in a way that all error codes are falsey. This
resulted in completely dropping the error information from the response
object.

After this change, error codes will actually be propagated up into error
logging tools (New Relic, Splunk, etc.).

requests.models.Response implementation: https://docs.python-requests.org/en/latest/_modules/requests/models/#Response
@pwnage101 pwnage101 force-pushed the pwnage101/fix-subsidy-api-error-logging branch from 86b23e2 to 16790eb Compare January 30, 2024 23:23
@pwnage101 pwnage101 merged commit 36a5cfd into main Jan 31, 2024
4 checks passed
@pwnage101 pwnage101 deleted the pwnage101/fix-subsidy-api-error-logging branch January 31, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants