forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: print arbitrary javascript exception value in node report
PR-URL: nodejs#38009 Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
- Loading branch information
1 parent
8a973fd
commit 55745a1
Showing
6 changed files
with
118 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Flags: --report-uncaught-exception | ||
'use strict'; | ||
// Test producing a report on uncaught exception. | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const helper = require('../common/report'); | ||
const tmpdir = require('../common/tmpdir'); | ||
|
||
const exception = 1; | ||
|
||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
|
||
process.on('uncaughtException', common.mustCall((err) => { | ||
assert.strictEqual(err, exception); | ||
const reports = helper.findReports(process.pid, tmpdir.path); | ||
assert.strictEqual(reports.length, 1); | ||
console.log(reports[0]); | ||
helper.validate(reports[0], [ | ||
['header.event', 'Exception'], | ||
['javascriptStack.message', `${exception}`], | ||
]); | ||
})); | ||
|
||
throw exception; |
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,25 @@ | ||
// Flags: --report-uncaught-exception | ||
'use strict'; | ||
// Test producing a report on uncaught exception. | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const helper = require('../common/report'); | ||
const tmpdir = require('../common/tmpdir'); | ||
|
||
const exception = Symbol('foobar'); | ||
|
||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
|
||
process.on('uncaughtException', common.mustCall((err) => { | ||
assert.strictEqual(err, exception); | ||
const reports = helper.findReports(process.pid, tmpdir.path); | ||
assert.strictEqual(reports.length, 1); | ||
console.log(reports[0]); | ||
helper.validate(reports[0], [ | ||
['header.event', 'Exception'], | ||
['javascriptStack.message', 'Symbol(foobar)'], | ||
]); | ||
})); | ||
|
||
throw exception; |