From c9fabb0e1d5f2542f703fbd9b5b3617e60113644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 14 Jan 2022 14:34:08 -0500 Subject: [PATCH] refactor: add method to error messages --- src/controllers/errors.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/errors.js b/src/controllers/errors.js index 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-vars const 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) { // esl return 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) { // esl await 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); }