Skip to content
tRPC

Partners

Function: rethrowNextErrors()

On this page

rethrowNextErrors(error): void

Defined in: packages/server/src/adapters/next-app-dir/rethrowNextErrors.ts:50

Turns a caught TRPCError into the Next.js control-flow error it stands for: a NOT_FOUND code calls notFound(), a TRPCRedirectError calls redirect(), and a notFound() or redirect() error in cause is rethrown. It only takes a TRPCError; rethrow Next.js's own errors, such as those nextAppDirCaller throws, yourself.

Parameters

ParameterType
errorTRPCError

Returns

void