Errors handling
Error handling
Only async route functions and middlewares are handled
app.setErrorHandler(
(err: Error, req: HttpRequest, res: HttpResponse): HttpResponse => {
if (checkSomething(err)) {
return res.send({
status: 'error',
status_code: 500,
message: 'oops'
})
}
}
);GET http://localhost:8000/error-route
Path Parameters
Name
Type
Description
string
Not found handler
GET http://localhost:8000/anyUrl
Path Parameters
Name
Type
Description
string
Validation error handler
Validation error handler unavailable for pro-slim version
GET http://locahost:8000/validate-error
Request Body
Name
Type
Description
foo
string
bar
Last updated
Was this helpful?