Skip to content

Report TypeError raised inside a view as a Server error - #756

Open
SAY-5 wants to merge 1 commit into
cenobites:masterfrom
SAY-5:fix-view-typeerror-server-error
Open

Report TypeError raised inside a view as a Server error#756
SAY-5 wants to merge 1 commit into
cenobites:masterfrom
SAY-5:fix-view-typeerror-server-error

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 10, 2026

Copy link
Copy Markdown

Fixes #755.

A TypeError raised inside a view (from the view's own logic, not from parameter validation) was caught by the same handler that maps typeguard's argument checking to InvalidParamsError, so the caller got a 400 Invalid params response instead of a 500 Server error.

typeguard reports argument type mismatches as TypeCheckError (which is not a TypeError), so the view call is now wrapped in a narrower handler that only converts TypeCheckError to InvalidParamsError. A plain TypeError from the view body propagates and is reported as a Server error, while binding and annotated-metadata failures still map to Invalid params. Added a regression test in test_site.py.

Signed-off-by: say <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError risen inside view is converted to 400 InvalidParamsError

1 participant