From b29c897da358a60251d0eea533fc1e80f8bb6564 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Mon, 6 May 2024 21:19:10 +0200 Subject: [PATCH] Fixed passing error to IncorrectUsageError - we should pass it as `err` and not `error` - this probably slipped in because the catch parameter is called `error`, so I've updated that and fixed the references --- ghost/core/core/server/web/admin/controller.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ghost/core/core/server/web/admin/controller.js b/ghost/core/core/server/web/admin/controller.js index eee566cd4b..cb00ab7b50 100644 --- a/ghost/core/core/server/web/admin/controller.js +++ b/ghost/core/core/server/web/admin/controller.js @@ -47,16 +47,15 @@ module.exports = function adminController(req, res) { } res.sendFile(templatePath, {headers}); - } catch (error) { - if (error.code === 'ENOENT') { + } catch (err) { + if (err.code === 'ENOENT') { throw new errors.IncorrectUsageError({ message: tpl(messages.templateError.message, {templatePath}), context: tpl(messages.templateError.context), help: tpl(messages.templateError.help, {link: 'https://ghost.org/docs/install/source/'}), - error: error + err }); - } else { - throw error; } + throw err; } };