Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Conversation

@lmarkscp
Copy link
Contributor

@lmarkscp lmarkscp commented Jul 18, 2022

Description

The current handling of API response error(s) in JupiterOneClient._execute_query, besides the status codes 429 and 503, expects the response content to be JSON, but that isn't always the case, such as 401 Unauthorized. This caused a JSONDecodeError to be thrown instead which obfuscated the actual error in the API response in which the content type was not application/json.

Added handling of 401 and other responses that aren't JSON.
Added tests for the new error handling.

References

auth0#12

Testing

I updated the pytests in test_client.py, but manual tests just require using a bogus account or token.

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@lmarkscp lmarkscp changed the title Improve response error handling - Fixes [auth0#12](https://github.com/auth0/jupiterone-python-sdk/issues/12) Improve response error handling - Fixes auth0#12 Jul 18, 2022
@lmarkscp lmarkscp changed the title Improve response error handling - Fixes auth0#12 Improve response error handling - Fixes auth0 Issue 12 Jul 18, 2022
@SeaBlooms
Copy link

@gvauter can this be merged?

@gvauter gvauter merged commit 49537d1 into auth0:master Aug 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants