# Function: rethrowNextErrors()

> 

> **rethrowNextErrors**(`error`): `void`

Defined in: [packages/server/src/adapters/next-app-dir/rethrowNextErrors.ts:50](https://github.com/trpc/trpc/blob/7c907acfd8b31929214792e3b8c2ad7a8ac72563/packages/server/src/adapters/next-app-dir/rethrowNextErrors.ts#L50)

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

| Parameter | Type |
| ------ | ------ |
| `error` | [`TRPCError`](https://trpc.io/docs/typedoc/server/index/classes/TRPCError.md) |

## Returns

`void`
