node/test/message/util_inspect_error.js
Ruben Bridgewater e852289802
util: fix inspected stack indentation
Error stacks and multiline error messages were not correct indented.
This is fixed by this patch.

PR-URL: https://github.com/nodejs/node/pull/20802
Refs: https://github.com/nodejs/node/issues/20253
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-21 17:38:16 +02:00

13 lines
334 B
JavaScript

'use strict';
require('../common');
const util = require('util');
const err = new Error('foo\nbar');
console.log(util.inspect({ err, nested: { err } }, { compact: true }));
console.log(util.inspect({ err, nested: { err } }, { compact: false }));
err.foo = 'bar';
console.log(util.inspect(err, { compact: true, breakLength: 5 }));