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
At the moment, when the generated parsing code fails on the server, an error is thrown, which by default gets turned into the HTTP response status 500.
However, if e.g. a required query item was missing, that should return 400, conventionally.
Unfortunately, server adopters don't have a good way to even handle it in a middleware, as RuntimeError is internal.
Proposed solution
Details to be discussed, but we should offer some signal whether the underlying RuntimeError is "caused by input" (e.g. bad request) or "caused by server" (e.g. handler throws an error).
Probably should also offer an "audited error string" that we guarantee is safe to send back to the caller, for example "missing required query item 'foo'". As getting a 400 without details can be infuriating.
Motivation
At the moment, when the generated parsing code fails on the server, an error is thrown, which by default gets turned into the HTTP response status 500.
However, if e.g. a required query item was missing, that should return 400, conventionally.
Unfortunately, server adopters don't have a good way to even handle it in a middleware, as
RuntimeError
is internal.Proposed solution
Details to be discussed, but we should offer some signal whether the underlying RuntimeError is "caused by input" (e.g. bad request) or "caused by server" (e.g. handler throws an error).
Probably should also offer an "audited error string" that we guarantee is safe to send back to the caller, for example "missing required query item 'foo'". As getting a 400 without details can be infuriating.
Some questions:
Alternatives considered
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: