From d42703dd9f13ebbbf6bbdfb89965eb6819cffe92 Mon Sep 17 00:00:00 2001 From: meowtec Date: Wed, 5 Nov 2014 11:03:33 +0800 Subject: [PATCH] Correct logError to log err which has undefined `message` closes #4384 - if err is `object` && `err.message` isNOT `string`, let err = `An unknown error occurred.` --- core/server/errors/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/server/errors/index.js b/core/server/errors/index.js index 05179aa8ce..389ca0bea0 100644 --- a/core/server/errors/index.js +++ b/core/server/errors/index.js @@ -107,7 +107,13 @@ errors = { stack = err ? err.stack : null; - err = _.isString(err) ? err : (_.isObject(err) ? err.message : 'An unknown error occurred.'); + if (!_.isString(err)) { + if (_.isObject(err) && _.isString(err.message)) { + err = err.message; + } else { + err = 'An unknown error occurred.'; + } + } // Overwrite error to provide information that this is probably a permission problem // TODO: https://github.com/TryGhost/Ghost/issues/3687