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

custom unmarshal response error #1211

Closed
FunnyDevP opened this issue Apr 16, 2020 · 2 comments
Closed

custom unmarshal response error #1211

FunnyDevP opened this issue Apr 16, 2020 · 2 comments

Comments

@FunnyDevP
Copy link

FunnyDevP commented Apr 16, 2020

how to custom http response error. when cannot unmarshal http request data to model

Ex.

From...
{
    "error": "json: cannot unmarshal number into Go value of type string",
    "code": 3,
    "message": "json: cannot unmarshal number into Go value of type string"
}
To...
{
  "error": {
    "field1": 11013,
    "field2": 1401,
    "field3": 0,
    "field4": "unmarshal type error"
  }
}
@FunnyDevP FunnyDevP changed the title custom marshal response error custom unmarshal response error Apr 16, 2020
@johanbrandhorst
Copy link
Collaborator

Hi @FunnyDevP, thanks for raising your issue. There is a section on our documentation site about how to configure a custom error handler: https://grpc-ecosystem.github.io/grpc-gateway/docs/customizingyourgateway.html

@Manask322
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants