Skip to content

custom unmarshal response error #1211

Closed
@FunnyDevP

Description

@FunnyDevP

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"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions