'use strict'; const logger = require('../logger')(__filename); function errorHandler(error, req, res, _next) { logger.warn(`Failed to fulfill request to ${req.path}: ${error.message}`); if (error.httpCode) { res.status(error.httpCode).send(error.message); return; } res.status(500).send('Oops... our server messed up. We will be investigating this incident, our apologies for the inconvenience.'); } module.exports = errorHandler;