Optional
isException: IsException<Exception>A function that returns whether error
is a known application exception that should be sent to the client when thrown. If not provided, only BaseValidationException exceptions will be caught.
Wrap a route handler to catch known exceptions and send them to the client.
If an exception is encountered that does not match the ExceptionWrapper#isException function, it will be rethrown.
The route handler function to wrap
A wrapped version of the route handler
Rest
...parameters: Parameters<NextRouteHandler<ResponseBody, SegmentData>>
A class for wrapping Next.js API route handlers to catch known application exceptions which should be sent to the client when thrown.
Automatically catches BaseValidationException exceptions from validateQuery, validateParams, and validateBody.
Example