Functions

Preserve framework control-flow exceptions

Broad exception handling can swallow framework navigation and rendering interrupts. This unstable helper forwards recognized internal control-flow errors. Prefer narrow try/catch blocks and call redirect or notFound outside the catch when possible. Example context: isolated Next.js 16.x candidate; snippet is partial unless it defines a complete convention file. Lifecycle: unstable. Expected behavior / verification: In a reviewed fixture assert that a not-found interrupt still reaches its fallback; an ordinary application error follows the local error path. Do not expose error details. Source: https://nextjs.org/docs/app/api-reference/functions/unstable_rethrow Exact installed signature, typecheck and framework execution not run.

Formal Syntax & Structure

nextjs syntaxnextjs
unstable_rethrow(error) from next/navigation

Working Example

Example Snippetnextjs
import { unstable_rethrow } from 'next/navigation'; export function handle(error: unknown){unstable_rethrow(error); return {message:'Operation failed'}}
Next.js Reference