Node.js based forum software built for the modern web
refactor: add method to error messages
Barış Soner Uşaklıc9fabb0e1d5f
diff --git a/src/controllers/errors.js b/src/controllers/errors.jsindex 58f12d9f98..8071c54371 100644--- a/src/controllers/errors.js+++ b/src/controllers/errors.js@@ -41,7 +41,7 @@ exports.handleURIErrors = async function handleURIErrors(err, req, res, next) {exports.handleErrors = async function handleErrors(err, req, res, next) { // eslint-disable-line no-unused-varsconst cases = {EBADCSRFTOKEN: function () {- winston.error(`${req.path}\n${err.message}`);+ winston.error(`${req.method} ${req.originalUrl}\n${err.message}`);res.sendStatus(403);},'blacklisted-ip': function () {@@ -69,7 +69,7 @@ exports.handleErrors = async function handleErrors(err, req, res, next) { // eslreturn helpers.formatApiResponse(status, res, err);}- winston.error(`${req.originalUrl}\n${err.stack}`);+ winston.error(`${req.method} ${req.originalUrl}\n${err.stack}`);res.status(status || 500);const data = {path: validator.escape(path),@@ -91,7 +91,7 @@ exports.handleErrors = async function handleErrors(err, req, res, next) { // eslawait defaultHandler();}} catch (_err) {- winston.error(`${req.originalUrl}\n${_err.stack}`);+ winston.error(`${req.method} ${req.originalUrl}\n${_err.stack}`);if (!res.headersSent) {res.status(500).send(_err.message);}