Handler invoked when an error occurs during execution of a Pages Router API endpoint.
Allows custom error handling such as logging, modifying the response, or sending a custom error payload.
The incoming Next.js API request.
The outgoing Next.js API response.
The error thrown during endpoint execution.
Returns void or a Promise that resolves when error handling is complete.
void
Handler invoked when an error occurs during execution of a Pages Router API endpoint.
Allows custom error handling such as logging, modifying the response, or sending a custom error payload.