Error handling middleware
Error handling middleware. Will format errors in HAL using @ambassify/error’s HAL serializer and emit them in application/hal+json. By default it also expects you to provide an expressify compatible logger so it can log these errors. If needed and possible, it also attaches a logref to the error being emitted.
Options
| Option | Type | Default | Description |
|---|---|---|---|
| logErrors | boolean |
true |
Enable or disable error logging |
| logger | Object | function |
({ req, res }) => req.context.logger | Specify a logger or a function that provides a logger when called with |
|
| logref | string | function |
({ req, res }) => req.context.logref | Specify a logref or a function that provides a logref when called with |