0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/server/middleware/api-error-handlers.js

10 lines
362 B
JavaScript
Raw Normal View History

var errors = require('../errors');
module.exports.errorHandler = function errorHandler(err, req, res, next) {
/*jshint unused:false */
var httpErrors = errors.formatHttpErrors(err);
errors.logError(err);
// Send a properly formatted HTTP response containing the errors
res.status(httpErrors.statusCode).json({errors: httpErrors.errors});
};