function
function4d ago

How can i check if an error is a TRPC Error in the browser?

error.message // NOT_FOUND (throwing this intentionally - i'd like to build a react error boundary that has specific handling for TRPC Errors like NOT_FOUND)
Object.getPrototypeOf(error) // default "Error" object/class
error instanceof TRPCClientError // false. this would have been my best bet.
error.message // NOT_FOUND (throwing this intentionally - i'd like to build a react error boundary that has specific handling for TRPC Errors like NOT_FOUND)
Object.getPrototypeOf(error) // default "Error" object/class
error instanceof TRPCClientError // false. this would have been my best bet.
Solution:
Inferring Types | tRPC
It is often useful to access the types of your API within your clients. For this purpose, you are able to infer the types contained in your AppRouter.
Jump to solution
1 Reply
Solution
function
function4d ago
Inferring Types | tRPC
It is often useful to access the types of your API within your clients. For this purpose, you are able to infer the types contained in your AppRouter.

Did you find this page helpful?