From 258b0acc519ea30a6f354dcd4b541ea11b8df41f Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 20 Apr 2022 15:44:26 +0800 Subject: [PATCH] Added specific 'code' properties for RequestNotAcceptableError refs https://github.com/TryGhost/Toolbox/issues/292 - There's a need to distinguish different types of RequestNotAcceptableError erros by their code. The code is also having an instructional name to give it more explicit utility (nice clue for a developer seeing the error) --- ghost/mw-error-handler/lib/mw-error-handler.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghost/mw-error-handler/lib/mw-error-handler.js b/ghost/mw-error-handler/lib/mw-error-handler.js index 17cda45bd0..3035c4153f 100644 --- a/ghost/mw-error-handler/lib/mw-error-handler.js +++ b/ghost/mw-error-handler/lib/mw-error-handler.js @@ -203,7 +203,8 @@ module.exports.resourceNotFound = (req, res, next) => { acceptVersion: req.headers['accept-version'], ghostVersion: `v${res.locals.safeVersion}` }), - help: tpl(messages.methodNotAcceptableVersionAhead.help) + help: tpl(messages.methodNotAcceptableVersionAhead.help), + code: 'UPDATE_GHOST' }; } else { errorOptions = { @@ -214,7 +215,8 @@ module.exports.resourceNotFound = (req, res, next) => { acceptVersion: req.headers['accept-version'], ghostVersion: `v${res.locals.safeVersion}` }), - help: tpl(messages.methodNotAcceptableVersionBehind.help) + help: tpl(messages.methodNotAcceptableVersionBehind.help), + code: 'UPDATE_CLIENT' }; }