Replies: 2 comments 1 reply
-
|
Context of type ErrWithFields interface {
error
Fields() map[string]interface{}
}You can either implement your own structured error or use |
Beta Was this translation helpful? Give feedback.
-
|
Am I correct in understanding that all errors generated by this framework will ultimately follow the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm probably missing something here but in my case the error responses don't match the format described by swagger.
For example:
Generates swagger like this:
{ "responses": { "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RestErrResponse" } } } } }, "RestErrResponse": { "type": "object", "properties": { "code": { "type": "integer", "description": "Application-specific error code." }, "context": { "type": "object", "additionalProperties": {}, "description": "Application context." }, "error": { "type": "string", "description": "Error message." }, "status": { "type": "string", "description": "Status text." } } } }i.e status, error, code, context
But the server actually sends
{ "status": "NOT_FOUND", "error": "not found: record not found" }Is there anyway I can also send a code and additional context in the response?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions