Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServerError should hint at whether the issue is the input (400) or the server (500) #644

Closed
czechboy0 opened this issue Oct 4, 2024 · 1 comment
Labels
kind/enhacement Improvements to existing feature.

Comments

@czechboy0
Copy link
Contributor

czechboy0 commented Oct 4, 2024

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

@czechboy0 czechboy0 added kind/feature New feature. status/triage Collecting information required to triage the issue. labels Oct 4, 2024
@czechboy0 czechboy0 added kind/enhacement Improvements to existing feature. and removed kind/feature New feature. status/triage Collecting information required to triage the issue. labels Oct 29, 2024
@czechboy0
Copy link
Contributor Author

Actually, just closing this, as it's already covered by #609, so let's centralize the discussion there.

@czechboy0 czechboy0 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhacement Improvements to existing feature.
Projects
None yet
Development

No branches or pull requests

1 participant