UNPKG

@mantris/appify

Version:
21 lines (16 loc) 384 B
'use strict' const { HttpError } = require('@mantris/commons') const ERROR_CODE = 'INTERNAL_SERVER_ERROR' /** * @returns {Function} Middleware. */ module.exports = () => { return (err, req, res, next) => { if (err instanceof HttpError) { return next(err) } return next( new HttpError.InternalServerError(ERROR_CODE, err.message, err.stack) ) } }