gofr icon indicating copy to clipboard operation
gofr copied to clipboard

Error Response like RFC 7807

Open pratik-k-ev opened this issue 11 months ago • 5 comments

Is your feature request related to a problem? Please describe. I want to return response with much more detail.

Describe the solution you'd like According to RFC 7807, can update the error response to support those fields.

Describe alternatives you've considered Not sure, maybe error customize the error response payload.

pratik-k-ev avatar Jan 27 '25 21:01 pratik-k-ev

@pratik-k-ev can you please elaborate your issue. Want to know more about the problem you are facing and how we can help to resolve it

Umang01-hash avatar Jan 30 '25 11:01 Umang01-hash

The current error response format is

{
    "error": {
        "message": "..."
    }
}

I wanted to extend error response fields and standardize according to RFC 7807.

Fields in RFC 7807

{
  "type": "string",
  "title": "string",
  "status": "integer",
  "detail": "string",
  "instance": "string",
  "extensions": {
    "field_name": "value"
  }
}

Is there way to follow this, or extend current error response fields?

pratik-k-ev avatar Jan 30 '25 11:01 pratik-k-ev

@Umang01-hash , Please assign this issue to me .....

coolwednesday avatar Feb 10 '25 05:02 coolwednesday

Hey @pratik-k-ev, the error approach is proposed and I can see it has also become obsolete being replaced by RFC 9457.

We might extend support to send such errors through custom errors, however can you please let me know if this is still under proposal or has been accepted ?

Based on that, we can work on this feature for your usecase.

coolwednesday avatar Feb 11 '25 05:02 coolwednesday

Is there a way to customise error payload fields..?

pratik-k-ev avatar Feb 11 '25 06:02 pratik-k-ev

@Umang01-hash, This PR can be closed now.

coolwednesday avatar Apr 29 '25 13:04 coolwednesday