Skip to main content

Supported Options

You can add options to (enable/disable) parsing for database errors (depends on your ORM) this is disabled by default. Also you can control logging options.

const options = {
mapDBExceptions: true, // deprecated
parseSequelizeExceptions: true,
parseMongooseExceptions: true,
parseTypeORMExceptions: true,
parseObjectionJSExceptions: true,
parseKnexJSExceptions: false,

loggerOptions: {
console: {
format: ':time :message', // optional - default message only
colored: true, // optional - default no color
},
// or
custom: new CustomLogger(),
},
}

expressExceptionHandler(options)
// or
const mappedError = exceptionMapper(err, options);