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

Unified ErrorResponse Type and Unified Handling #643

Closed
boumenot opened this issue Jun 8, 2017 · 2 comments
Closed

Unified ErrorResponse Type and Unified Handling #643

boumenot opened this issue Jun 8, 2017 · 2 comments
Assignees

Comments

@boumenot
Copy link
Member

boumenot commented Jun 8, 2017

I could not find an existing bug on this, so apologies if there is.

Most models have their own definition of an ErrorResponse and ErrorDetails. As near as I can tell the structure is mostly identical. (Deployment errors include a status, but that's the only difference I have seen thus far.)

The errors returned by Azure all appear to follow this style.

{
    "error": {
        "code": "BadRequest",
        "message": "There was a bad request",
        "details": [{
          "code": "NestedBadRequest",
          "message": "{ \"error\": ... }"
       }]
    }
}

It would be great if there was a unified way to handle errors. My own needs are simply to display the error to the user, but I am sure there are others. My example above showed a complex example, which I see quite often. The error contains an embedded (serialized) ErrorDetails in the message of a detail's message. One has to keep deserializing the JSON to get all of the errors that made up the change.

@mcardosos
Copy link
Contributor

Hello @boumenot !
I think we can do better with the error unmarshaling, yes. If you happen to have a fix for this, PRs are always welcome. In all cases, @marstr will take a look at this.

@marstr
Copy link
Member

marstr commented Oct 25, 2017

We've done some work here Azure/go-autorest#170 and here Azure/go-autorest#140. Hopefully this helps makes errors a little easier to deal with. If there are further needs, feel free to open another issue either here or in https://github.com/Azure/go-autorest

@marstr marstr closed this as completed Oct 25, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants