summaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js
index 478d5c0442..10c48d804b 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -590,6 +590,11 @@ function formatValue(ctx, value, recurseTimes) {
if (base.indexOf('\n at') === -1) {
base = `[${base}]`;
}
+ // The message and the stack have to be indented as well!
+ if (ctx.indentationLvl !== 0) {
+ const indentation = ' '.repeat(ctx.indentationLvl);
+ base = formatError(value).replace(/\n/g, `\n${indentation}`);
+ }
if (keyLength === 0)
return base;
} else if (isAnyArrayBuffer(value)) {