lib: refactor ERR_SYNTHETIC

- Tidy up description in docs.
- Remove a second definition in the docs.
- Remove unused string input parameter.
- Remove duplicate "JavaScript Callstack" in error messages.

PR-URL: https://github.com/nodejs/node/pull/25749
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
cjihrig 2019-01-27 19:08:35 -05:00
parent 80a18cac8b
commit 5aa89d616f
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5
3 changed files with 6 additions and 14 deletions

View File

@ -1692,8 +1692,8 @@ length.
<a id="ERR_SYNTHETIC"></a>
#### ERR_SYNTHETIC
An artificial error object used to capture call stack when diagnostic report
is produced.
An artificial error object used to capture the call stack for diagnostic
reports.
<a id="ERR_SYSTEM_ERROR"></a>
### ERR_SYSTEM_ERROR
@ -2233,12 +2233,6 @@ size.
This `Error` is thrown when a read is attempted on a TTY `WriteStream`,
such as `process.stdout.on('data')`.
<a id="ERR_SYNTHETIC"></a>
#### 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

View File

@ -923,7 +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_SYNTHETIC', 'JavaScript Callstack', 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);

View File

@ -101,13 +101,11 @@ exports.setup = function() {
emitExperimentalWarning('report');
if (err == null) {
if (file == null) {
return nr.triggerReport(new ERR_SYNTHETIC(
'JavaScript Callstack').stack);
return nr.triggerReport(new ERR_SYNTHETIC().stack);
}
if (typeof file !== 'string')
throw new ERR_INVALID_ARG_TYPE('file', 'String', file);
return nr.triggerReport(file, new ERR_SYNTHETIC(
'JavaScript Callstack').stack);
return nr.triggerReport(file, new ERR_SYNTHETIC().stack);
}
if (typeof err !== 'object')
throw new ERR_INVALID_ARG_TYPE('err', 'Object', err);
@ -120,7 +118,7 @@ exports.setup = function() {
getReport(err) {
emitExperimentalWarning('report');
if (err == null) {
return nr.getReport(new ERR_SYNTHETIC('JavaScript Callstack').stack);
return nr.getReport(new ERR_SYNTHETIC().stack);
} else if (typeof err !== 'object') {
throw new ERR_INVALID_ARG_TYPE('err', 'Objct', err);
} else {