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

feat(client): add restapi error message to exceptions raised by client #764

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

keithmanville
Copy link
Collaborator

addresses #763

Copy link
Collaborator

@jkglasbrenner jkglasbrenner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, I think my reasoning for omitting response.text from the raised error message was because the full details would be captured and returned if you turn on the logger and set the logging level to DEBUG. However, that requires you to do this in the first place, which isn't common in things like Jupyter notebooks, so it makes sense to also include it in the raised Exception. I like the solution of having it be a second argument to the Exception, since that returns a tuple of error messages.

In addition, you'll want to also make these changes in the test client, such as here:

raise StatusCodeError(f"Error code returned: {response.status_code}")

Co-authored-by: James K. Glasbrenner <jglasbrenner@mitre.org>
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.

2 participants