Repository navigation
|
Maybe I just missed it, but I haven't found a good way to use custom error classes as an alternative to Are we tied to |
Replies: 2 comments 3 replies
|
Yes, oRPC uses If you want your custom error classes on both sides, the usual approach is:
This way your app code can still work with your own error classes, and oRPC only sees |
|
I guess I should have been more clear in my original question. We're only using the
I'm also utilizing the |
I guess I should have been more clear in my original question. We're only using the
OpenAPIHandler. I randomly discovered thecustomErrorResponseBodyEncoderanderrorStatusMapoptions for theOpenAPIHandlerconstructor, which allows me to preserve our error structure without needing any client changes. Here is what I'm doing.ORPCErrorwith the custom error incauseand any supporting information (like validation errors) indata. Throw theORPCError.customErrorResponseBodyEncoderfunction to unwrap theORPCErrorand return the desired error format.I'm also utilizing the
errorStatusMapoption to map our custom error…