Skip to content

Commit 99bc0df

Browse files
cjihrigaddaleax
authored andcommitted
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: #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>
1 parent 6967407 commit 99bc0df

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

doc/api/errors.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -1692,8 +1692,8 @@ length.
16921692
<a id="ERR_SYNTHETIC"></a>
16931693
#### ERR_SYNTHETIC
16941694

1695-
An artificial error object used to capture call stack when diagnostic report
1696-
is produced.
1695+
An artificial error object used to capture the call stack for diagnostic
1696+
reports.
16971697

16981698
<a id="ERR_SYSTEM_ERROR"></a>
16991699
### ERR_SYSTEM_ERROR
@@ -2227,12 +2227,6 @@ size.
22272227
This `Error` is thrown when a read is attempted on a TTY `WriteStream`,
22282228
such as `process.stdout.on('data')`.
22292229

2230-
<a id="ERR_SYNTHETIC"></a>
2231-
#### ERR_SYNTHETIC
2232-
2233-
An artifical error object used to capture call stack when diagnostic report
2234-
is produced.
2235-
22362230

22372231
[`'uncaughtException'`]: process.html#process_event_uncaughtexception
22382232
[`--force-fips`]: cli.html#cli_force_fips

lib/internal/errors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT',
923923
'stream.unshift() after end event', Error);
924924
E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error);
925925
E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error);
926-
E('ERR_SYNTHETIC', 'JavaScript Callstack: %s', Error);
926+
E('ERR_SYNTHETIC', 'JavaScript Callstack', Error);
927927
E('ERR_SYSTEM_ERROR', 'A system error occurred', SystemError);
928928
E('ERR_TLS_CERT_ALTNAME_INVALID',
929929
'Hostname/IP does not match certificate\'s altnames: %s', Error);

lib/internal/process/report.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,11 @@ exports.setup = function() {
101101
emitExperimentalWarning('report');
102102
if (err == null) {
103103
if (file == null) {
104-
return nr.triggerReport(new ERR_SYNTHETIC(
105-
'JavaScript Callstack').stack);
104+
return nr.triggerReport(new ERR_SYNTHETIC().stack);
106105
}
107106
if (typeof file !== 'string')
108107
throw new ERR_INVALID_ARG_TYPE('file', 'String', file);
109-
return nr.triggerReport(file, new ERR_SYNTHETIC(
110-
'JavaScript Callstack').stack);
108+
return nr.triggerReport(file, new ERR_SYNTHETIC().stack);
111109
}
112110
if (typeof err !== 'object')
113111
throw new ERR_INVALID_ARG_TYPE('err', 'Object', err);
@@ -120,7 +118,7 @@ exports.setup = function() {
120118
getReport(err) {
121119
emitExperimentalWarning('report');
122120
if (err == null) {
123-
return nr.getReport(new ERR_SYNTHETIC('JavaScript Callstack').stack);
121+
return nr.getReport(new ERR_SYNTHETIC().stack);
124122
} else if (typeof err !== 'object') {
125123
throw new ERR_INVALID_ARG_TYPE('err', 'Objct', err);
126124
} else {

0 commit comments

Comments
 (0)