Skip to content

Commit d42703d

Browse files
committed
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.`
1 parent bc3c01d commit d42703d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/server/errors/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ errors = {
107107

108108
stack = err ? err.stack : null;
109109

110-
err = _.isString(err) ? err : (_.isObject(err) ? err.message : 'An unknown error occurred.');
110+
if (!_.isString(err)) {
111+
if (_.isObject(err) && _.isString(err.message)) {
112+
err = err.message;
113+
} else {
114+
err = 'An unknown error occurred.';
115+
}
116+
}
111117

112118
// Overwrite error to provide information that this is probably a permission problem
113119
// TODO: https://github.com/TryGhost/Ghost/issues/3687

0 commit comments

Comments
 (0)