diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-05-17 03:26:21 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-05-21 17:38:16 +0200 |
commit | e85228980278eb66da05110b154149a864c4cd1d (patch) | |
tree | 835d35bfb4a0bf3b965f7b18fdb85c341c086476 /test/message | |
parent | 8de83725ac3aa05a12acbbd27012c4282af7635c (diff) | |
download | android-node-v8-e85228980278eb66da05110b154149a864c4cd1d.tar.gz android-node-v8-e85228980278eb66da05110b154149a864c4cd1d.tar.bz2 android-node-v8-e85228980278eb66da05110b154149a864c4cd1d.zip |
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>
Diffstat (limited to 'test/message')
-rw-r--r-- | test/message/util_inspect_error.js | 12 | ||||
-rw-r--r-- | test/message/util_inspect_error.out | 63 |
2 files changed, 75 insertions, 0 deletions
diff --git a/test/message/util_inspect_error.js b/test/message/util_inspect_error.js new file mode 100644 index 0000000000..20affd6c71 --- /dev/null +++ b/test/message/util_inspect_error.js @@ -0,0 +1,12 @@ +'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 })); diff --git a/test/message/util_inspect_error.out b/test/message/util_inspect_error.out new file mode 100644 index 0000000000..406d8112ce --- /dev/null +++ b/test/message/util_inspect_error.out @@ -0,0 +1,63 @@ +{ err: + Error: foo + bar + at *util_inspect_error* + at * + at * + at * + at * + at * + at * + at * + at * + nested: + { err: + Error: foo + bar + at *util_inspect_error* + at * + at * + at * + at * + at * + at * + at * + at * } } +{ + err: Error: foo + bar + at *util_inspect_error* + at * + at * + at * + at * + at * + at * + at * + at *, + nested: { + err: Error: foo + bar + at *util_inspect_error* + at * + at * + at * + at * + at * + at * + at * + at * + } +} +{ Error: foo +bar + at *util_inspect_error* + at * + at * + at * + at * + at * + at * + at * + at * + foo: 'bar' } |