This defines a HandlerWithError adapter to allow requests to return errors instead of having to handle error cases themselves.
Instead of having a specific HttpError type, this is now an interface with a single RespondError method. (The interface is called ErrorResponder, there is a new HttpError type that can be used to compose more specific types.)
There are custom HttpError implementations for specific error cases, so that the error handling logic can be moved out of the request handlers and into the respective implementations of RespondError.
In the future error responses should be RFC9457 compliant (see #3).
This defines a
HandlerWithError
adapter to allow requests to return errors instead of having to handle error cases themselves.Instead of having a specific
HttpError
type, this is now an interface with a singleRespondError
method. (The interface is calledErrorResponder
, there is a newHttpError
type that can be used to compose more specific types.)There are custom HttpError implementations for specific error cases, so that the error handling logic can be moved out of the request handlers and into the respective implementations of
RespondError
.In the future error responses should be RFC9457 compliant (see #3).
ref: #17