-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
util: fix inspected stack indentation
Error stacks and multiline error messages were not correct indented. This is fixed by this patch. PR-URL: #20802 Refs: #20253 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
- Loading branch information
1 parent
38bc5fb
commit f0d6a37
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' } |