mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-21 09:11:29 +03:00
15 lines
329 B
JavaScript
15 lines
329 B
JavaScript
const ErrorResponse = require('../utils/ErrorResponse');
|
|
|
|
const errorHandler = (err, req, res, next) => {
|
|
let error = { ...err };
|
|
error.message = err.message;
|
|
|
|
console.log(err);
|
|
|
|
res.status(err.statusCode || 500).json({
|
|
success: false,
|
|
error: error.message || 'Server Error'
|
|
})
|
|
}
|
|
|
|
module.exports = errorHandler; |