-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Rework error handling and state flow in the Azure connection #5356
Conversation
nts: we can remove AzureExitStr as well. |
* _RequestHelper no longer eats exceptions. * Delete the "no internet" error message. * Wrap exceptions coming out of Azure API in a well-known type. * Catch by type. * Extract error codes for known failures (keep polling, invalid grant). * When we get an Invalid Grant, dispose of the cached refresh token and force the user to log in again. * Catch all printable exceptions and print them. * Remove the NoConnect state completely -- just bail out when an exception hits the toplevel of the output thread. * Move 3x logic into _RefreshTokens and pop exceptions out of it. * Begin abstracting into AzureClient
Switch to 2020 tenant API; use defaultDomain; put defaultDomain into the display name. Consider: not showing the tenant GUID at all?
89b9de6
to
2417105
Compare
Confirmed this actually fixes #4803, doesn’t just improve diagnostics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm fine with this. If we want, we can pull the FQDN without impacting too much else of this PR, right?
{ | ||
try | ||
{ | ||
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the heck
does this just get the current exception if you're already in a catch
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES it’s great
Yeah def |
Instead of passing around four loose variables, create a Tenant class and use that for packing/unpacking into/out of json (and the windows credential store, where we "cleverly" used json for the tenant info there too). When displaying a tenant, use its display name if there is one, the unknown resource string if there isn't, and the default domain if there is one and the ID if there isn't. Fixes #5325.
2417105
to
38429b5
Compare
🎉 Handy links: |
38429b5 - az: rework tenant/tenant storage and fix display names
Instead of passing around four loose variables, create a Tenant class
and use that for packing/unpacking into/out of json (and the windows
credential store, where we "cleverly" used json for the tenant info
there too).
When displaying a tenant, use its display name if there is one, the
unknown resource string if there isn't, and the default domain if there
is one and the ID if there isn't.
Fixes #5325.
9f6ebcb - az: use {fmt} for formatting request bodies
8a54e09 - az: remove dead strings
8985c38 - az: rework Request/HeaderHelper to Send(Authenticated?)ReqReturningJson
7ad9e88 - az: rewrite polling to use std::chrono
69b59cb - az: remove HR returns from state machine
2fe5f66 - az: rename state handlers from _XHelper to _RunXState
a1de8c3 - az: cleanup, prefix user input with >, remove namespaces
b5e16c2 - az: show more tenant info
Switch to 2020 tenant API; use defaultDomain; put defaultDomain into the
display name.
Consider: not showing the tenant GUID at all?
61f06e7 - az: rework error handling
Summary of the Pull Request
This is a tidying-up of the azure connection. It improves error logging (like: it actually emits error logs...) and retry logic and the state machine and it audits the exit points of the state machine for exceptions and removes the HRESULT returns (so they either succeed and transition to a new state or throw an exception or are going down anyway).
There's also a change in here that changes how we display tenants. It adds the "default domain" to the name, so that instead of seeing this:
you see this
References
Fixes #5325 (by addressing its chief complaint).
Fixes #4803.
Adds diagnosability for #4575.
PR Checklist
Detailed Description of the Pull Request / Additional comments
As above.
Validation Steps Performed
Logged in, out, around a good number of times.