nokia / restful

A powerful RESTful framework for Go.
BSD 3-Clause "New" or "Revised" License
17 stars 15 forks source link

Error status: body #60

Closed Som-Som-CC closed 10 months ago

Som-Som-CC commented 10 months ago

When client receives error status code, e.g. on Post() err, then GetErrStatusCode(err) int returns the status code. But the body and related content-type is not available for the client app. It would be nice to extend Error with these. Probably with some limitation on body size to 1kB.

Som-Som-CC commented 10 months ago

It is a bit unclear what to do with the body on the server/lambda side. If no error detail is added e.g. using NewError() or err.ProblemDetails(), then the body could be proxied.

If the API consumer is a 3rd party, then one may not want to expose all the internal error details. Like DB node psql1.company.net not reachable. User: funny-app. DB error: TLS certificate expired on 01-01-2024.