fix: include error detail in GenericOpenAPIError.Error() - #585
Open
exitcode0 wants to merge 2 commits into
Open
Conversation
When a GenericOpenAPIError contains an unpacked Error model, the Error() method now returns the error summary and any error causes instead of just the HTTP status text. This provides much more actionable error messages to API consumers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
GenericOpenAPIError.Error()now surfaces the Okta error summary, error code, error ID, and error causes instead of returning only the HTTP status textokta/client.goMotivation
When an Okta API call fails,
GenericOpenAPIError.Error()only returns a generic message like"the server responded with status 400". The structured error detail from the response body (error summary, code, causes) is available viaGenericOpenAPIError.Model()but isn't included in the error string, making debugging difficult without explicit type assertions.Example output
Test plan
GenericOpenAPIError.Error()returns enriched message when model is*Errore.errorwhen model is nil or a different type