Closed dylanhitt closed 4 days ago
Throwing is fine as it's made at start time and not per request, thanks for this PR!
Yes it's a good change we can make. I personally only use HTTPError on my projects, that's why I don't work on custom error handling, but I agree we can make it better !
Merged with #229
Opened this for two reasons. First, this PR.
Saw this today figured we should panic or
slog.Error
withos.exit
?That being said I noticed that with the default
ErrorHandler
we provide it is not possible to return custom error types as we are always returningHTTPError
although the OpenAPI spec generated would describe the custom type being in the response. There seems to be two options:HTTPError
when it adheres to one of our interfaces. The issue with this though is that we no longer default to RFC 9457 errors format; honestly I'm not really sure it really matters as users need to implement an HTTPErrror or one of our interfaces to really get an RFC 9457 output.