mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
b1dd96ecc2
refs #2757 - As per this convo: https://ghost.slack.com/archives/ghost/p1436895553007431 the 405 handling in Ghost is acting as a catch all, rather than only returning when the wrong HTTP method is used for a valid resource. - Implementing proper 405 with express is a challenge, and therefore we defer doing this work until it is needed
10 lines
362 B
JavaScript
10 lines
362 B
JavaScript
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});
|
|
};
|