UNPKG

@mantris/appify

Version:
18 lines (14 loc) 375 B
'use strict' const { HttpError } = require('@mantris/commons') /** * @param {import('@bugsnag/js').Bugsnag.Client} client * @return {Function} Middleware. */ module.exports = (client) => { return (err, req, res, next) => { if (err instanceof HttpError) { return next(err) } return client.getPlugin('express').errorHandler(err, req, res, next) } }