You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could be returned, thus easily implementing custom errors in a much less verbose way.
This would also allow us to have possible hooks in responses, to avoid having more telemetry/logging directly in the handler, since those types could only wrap parts intended for the users, while we could abstract the telemetry to our own functions, thus making error handling go from 5/7 lines per error to 1 or 2.
The text was updated successfully, but these errors were encountered:
Right now, returning concrete types is nice for well defined return types, such as 200s, but once you want to return simple errors, it becomes a pain.
For example, let's say I want to return an InternalServerError with an error code and clarification.
With the status quo, this looks like:
This gets really verbose really fast.
What we could have instead is
and use it like so:
Any type implementing
Could be returned, thus easily implementing custom errors in a much less verbose way.
This would also allow us to have possible hooks in responses, to avoid having more telemetry/logging directly in the handler, since those types could only wrap parts intended for the users, while we could abstract the telemetry to our own functions, thus making error handling go from 5/7 lines per error to 1 or 2.
The text was updated successfully, but these errors were encountered: