Skip to content

Middleware Defined Errors #757

Answered by unnoq
rrmesquita asked this question in Q&A
Jul 11, 2025 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

This is expected behavior because procedures do not inherit errors from middleware. When you throw a defined error from middleware, oRPC attempts to validate it and sets the result to false if no corresponding error is defined in the procedure.

This was also a feature request, but after multiple attempts, I decided not to support it. oRPC middleware can become overly complicated, and I want type-safe errors to remain optional without affecting the dx at all.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@rrmesquita
Comment options

Answer selected by rrmesquita
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants