Skip to content
This repository was archived by the owner on Oct 6, 2020. It is now read-only.

Try to parse into a known error on fail.#248

Merged
MindFlavor merged 1 commit intoMindFlavor:masterfrom
skeet70:expose-response
Mar 23, 2020
Merged

Try to parse into a known error on fail.#248
MindFlavor merged 1 commit intoMindFlavor:masterfrom
skeet70:expose-response

Conversation

@skeet70
Copy link
Contributor

@skeet70 skeet70 commented Mar 5, 2020

Get the body text and try to parse into a login response.
If that fails try to parse the body to get an error_description from
Azure. If that fails report whatever the original issue was with parsing
the response as the error.

ErrorResponse could be expanded on to recognize the error field and
give more useful info. Not sure what connecting ErrorResponse to
AzureError in a nice way looks like, but this leaves all the
interfaces the same for now.

Get the body text and try to parse into a login response.
If that fails try to parse the body to get an `error_description` from
Azure. If that fails report whatever the original issue was with parsing
as the error.

`ErrorResponse` could be expanded on to recognize the `error` field and
give more useful info. Not sure what connecting `ErrorResponse` to
`AzureError` in a nice way looks like, but this leaves all the
interfaces the same for now.
@skeet70
Copy link
Contributor Author

skeet70 commented Mar 9, 2020

The goal of this btw is to have better error messages. Right now if you authorize_non_interactive and something goes wrong, Azure will frequently give you back a 200 OK with an error json in it, which the library tries to parse as a LoginResponse. You then get an error out of the library about how it failed to parse because something was missing instead of the error message that Azure had returned.

@MindFlavor
Copy link
Owner

Nice! Thank you!

@MindFlavor MindFlavor merged commit f3e69c4 into MindFlavor:master Mar 23, 2020
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.

2 participants