EXP2002: Unhandled error in a request handler
Sent in an error response, as its errorCode.
A handler or middleware threw an error that nothing in the application caught. The request is answered with 500 and the problem type internal-server-error, and the error is written to the log.
An application with no error handler registered also prints this code once as a development warning: it is being answered with a problem document outside production, and production answers differently.
Fix
- Fix the error. Outside production its message is the response's
detail; in every environment the log has it with its stack trace. - For a failure you expect, throw an
AppErrorwith the status that fits. It is not an unhandled error and does not carry this code. - Call
this.Middleware.setErrorHandler({ problemJson: true })so every environment answers the same way. See Error responses.
All codes are listed under Error responses.