ptzoptics-node-server/app/_helpers/error-handler.js

10 lines
261 B
JavaScript
Raw Normal View History

2018-11-02 15:24:39 -04:00
module.exports = errorHandler;
function errorHandler(err, req, res, next) {
console.log(err);
if (typeof err === 'string') {
return res.status(409).json({message: err});
}
return res.status(500).json({message: err.message});
}