-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
process: inspect error in case of a fatal exception
This makes sure that errors that shut down the application are inspected with `util.inspect()`. That makes sure that all extra properties on the error will be visible and also that the stack trace is highlighted (Node.js internal frames will be grey and node modules are underlined). PR-URL: #27243 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
- Loading branch information
Showing
11 changed files
with
76 additions
and
9 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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
*test*message*throw_custom_error.js:* | ||
throw ({ name: 'MyCustomError', message: 'This is a custom message' }); | ||
^ | ||
MyCustomError: This is a custom message | ||
{ name: 'MyCustomError', message: 'This is a custom message' } |
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ before | |
*test*message*throw_in_line_with_tabs.js:* | ||
throw ({ foo: 'bar' }); | ||
^ | ||
[object Object] | ||
{ foo: 'bar' } |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
*test*message*throw_non_error.js:* | ||
throw ({ foo: 'bar' }); | ||
^ | ||
[object Object] | ||
{ foo: 'bar' } |
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,10 @@ | ||
'use strict'; | ||
require('../common'); | ||
|
||
const { inspect } = require('util'); | ||
|
||
inspect.defaultOptions.colors = true; | ||
|
||
const err = new TypeError('foobar'); | ||
err.bla = true; | ||
throw err; |
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,14 @@ | ||
*test-fatal-error.js:* | ||
throw err; | ||
^ | ||
|
||
TypeError: foobar | ||
at Object.<anonymous> (*test-fatal-error.js:*) | ||
*[90m at *(internal*loader.js:*:*)*[39m | ||
*[90m at *(internal*loader.js:*:*)*[39m | ||
*[90m at *(internal*loader.js:*:*)*[39m | ||
*[90m at *(internal*loader.js:*:*)*[39m | ||
*[90m at *[39m | ||
*[90m at *[39m { | ||
bla: *[33mtrue*[39m | ||
} |