First attempt at improved error handling #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pr adds a new Other enum item to AuthResponse, which allows us to capture any json, and display it. Output goes from:
AuthError(RequestError(RequestError(reqwest::Error { kind: Decode, source: Error("data did not match any variant of untagged enum AuthResponse", line: 0, column: 0) })))
To
AuthError(UnexpectedResponse(Some(Object {"code": String("390186"), "data": Object {"age": Number(0), "errorCode": String("390186"), "internalError": Bool(false)}, "headers": Null, "message": String("Role 'ACCOUNTADMIN' specified in the connect string is not granted to this user. Contact your local system administrator, or attempt to login with another role, e.g. PUBLIC."), "success": Bool(false)})))
Which, in my opinion, is MUCH more actionable. True to my notes in the issue, I used the data received from the response to better implement the given error, and got the even cleaner response of:
AuthError(AuthFailed("390186", "Role 'ACCOUNTADMIN' specified in the connect string is not granted to this user. Contact your local system administrator, or attempt to login with another role, e.g. PUBLIC."))
This PR is purposely left dirty. Please provide general feedback for me to implement, and tell me whether you like the general idea, and then I will go through and clean everything up.
Closes #31