Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose TS type for onRequestError (#67859)
## What Expose the TS types for onRequestError API ### API ```ts type RequestErrorContext = { routerKind: 'Pages Router' | 'App Router'; routePath: string; routeType: 'render' | 'route' | 'action' | 'middleware'; renderSource?: 'react-server-components' | 'react-server-components-payload' | 'server-rendering'; }; export declare namespace Instrumentation { type onRequestError = (error: unknown, errorRequest: Readonly<{ method: string; url: string; headers: NodeJS.Dict<string | string[]>; }>, errorContext: Readonly<RequestErrorContext>) => void | Promise<void>; ``` ### Usage ```ts // instrumentation.ts import { type Instrumentation } from 'next' export const onRequestError: Instrumentation.onRequestError = ( err, request, context ) => { //... } ```
- Loading branch information