diff --git a/doc/api/errors.md b/doc/api/errors.md index f50c2334bc..48c3f5a2e7 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2233,6 +2233,12 @@ size. This `Error` is thrown when a read is attempted on a TTY `WriteStream`, such as `process.stdout.on('data')`. + +#### ERR_SYNTHETIC + +An artifical error object used to capture call stack when diagnostic report +is produced. + [`'uncaughtException'`]: process.html#process_event_uncaughtexception [`--force-fips`]: cli.html#cli_force_fips diff --git a/lib/internal/errors.js b/lib/internal/errors.js index d5cb86c3a5..f8d7aafeec 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -709,7 +709,6 @@ E('ERR_INSPECTOR_CLOSED', 'Session was closed', Error); E('ERR_INSPECTOR_NOT_AVAILABLE', 'Inspector is not available', Error); E('ERR_INSPECTOR_NOT_CONNECTED', 'Session is not connected', Error); E('ERR_INVALID_ADDRESS_FAMILY', 'Invalid address family: %s', RangeError); -E('ERR_SYNTHETIC', 'JavaScript Callstack: %s', Error); E('ERR_INVALID_ARG_TYPE', (name, expected, actual) => { assert(typeof name === 'string', "'name' must be a string"); @@ -924,6 +923,7 @@ E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error); E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error); E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error); +E('ERR_SYNTHETIC', 'JavaScript Callstack: %s', Error); E('ERR_SYSTEM_ERROR', 'A system error occurred', SystemError); E('ERR_TLS_CERT_ALTNAME_INVALID', 'Hostname/IP does not match certificate\'s altnames: %s', Error); diff --git a/test/common/index.js b/test/common/index.js index 72ad0c3b77..e7df290c3e 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -632,6 +632,12 @@ function skipIfInspectorDisabled() { } } +function skipIfReportDisabled() { + if (!process.config.variables.node_report) { + skip('Node Report is disabled'); + } +} + function skipIf32Bits() { if (bits < 64) { skip('The tested feature is not available in 32bit builds'); @@ -758,6 +764,7 @@ module.exports = { skipIf32Bits, skipIfEslintMissing, skipIfInspectorDisabled, + skipIfReportDisabled, skipIfWorker, get localhostIPv6() { return '::1'; }, diff --git a/test/common/report.js b/test/common/report.js new file mode 100644 index 0000000000..646660da49 --- /dev/null +++ b/test/common/report.js @@ -0,0 +1,43 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); + +const REPORT_SECTIONS = [ 'header', + 'javascriptStack', + 'nativeStack', + 'javascriptHeap', + 'libuv', + 'environmentVariables', + 'sharedObjects' ]; + +let tmppath = ''; + +exports.findReports = (pid, path) => { + // Default filenames are of the form + // report..