Middleware Defined Errors #757
-
I'm pretty new to this package, so let me know if I'm missing something. When I Is that intended, or should I open an issue for this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @rrmesquita! I'm Dosu and I’m helping the orpc team. You're right—middleware-defined errors should have To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
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 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. |
Beta Was this translation helpful? Give feedback.
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.