Skip to content

Commit bcca52c

Browse files
jasnelltargos
authored andcommitted
doc: document common warning types
Fixes: #24987 Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #36713 Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 97faeeb commit bcca52c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

doc/api/process.md

+24
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,29 @@ The `*-deprecation` command-line flags only affect warnings that use the name
460460
See the [`process.emitWarning()`][process_emit_warning] method for issuing
461461
custom or application-specific warnings.
462462

463+
#### Node.js warning names
464+
465+
There are no strict guidelines for warning types (as identified by the `name`
466+
property) emitted by Node.js. New types of warnings can be added at any time.
467+
A few of the warning types that are most common include:
468+
469+
* `'DeprecationWarning'` - Indicates use of a deprecated Node.js API or feature.
470+
Such warnings must include a `'code'` property identifying the
471+
[deprecation code][].
472+
* `'ExperimentalWarning'` - Indicates use of an experimental Node.js API or
473+
feature. Such features must be used with caution as they may change at any
474+
time and are not subject to the same strict semantic-versioning and long-term
475+
support policies as supported features.
476+
* `'MaxListenersExceededWarning'` - Indicates that too many listeners for a
477+
given event have been registered on either an `EventEmitter` or `EventTarget`.
478+
This is often an indication of a memory leak.
479+
* `'TimeoutOverflowWarning'` - Indicates that a numeric value that cannot fit
480+
within a 32-bit signed integer has been provided to either the `setTimeout()`
481+
or `setInterval()` functions.
482+
* `'UnsupportedWarning'` - Indicates use of an unsupported option or feature
483+
that will be ignored rather than treated as an error. One example is use of
484+
the HTTP response status message when using the HTTP/2 compatibility API.
485+
463486
### Signal events
464487

465488
<!--type=event-->
@@ -2654,6 +2677,7 @@ cases:
26542677
[`subprocess.kill()`]: child_process.md#child_process_subprocess_kill_signal
26552678
[`v8.setFlagsFromString()`]: v8.md#v8_v8_setflagsfromstring_flags
26562679
[debugger]: debugger.md
2680+
[deprecation code]: deprecations.md
26572681
[note on process I/O]: process.md#process_a_note_on_process_i_o
26582682
[process.cpuUsage]: #process_process_cpuusage_previousvalue
26592683
[process_emit_warning]: #process_process_emitwarning_warning_type_code_ctor

0 commit comments

Comments
 (0)