Skip to content

Commit 242ce19

Browse files
jasnelldanielleadams
authored andcommitted
doc: document common warning types
Fixes: #24987 Signed-off-by: James M Snell <[email protected]> PR-URL: #36713 Reviewed-By: Rich Trott <[email protected]>
1 parent 92af503 commit 242ce19

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
@@ -462,6 +462,29 @@ The `*-deprecation` command-line flags only affect warnings that use the name
462462
See the [`process.emitWarning()`][process_emit_warning] method for issuing
463463
custom or application-specific warnings.
464464

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

467490
<!--type=event-->
@@ -2698,6 +2721,7 @@ cases:
26982721
[`subprocess.kill()`]: child_process.md#child_process_subprocess_kill_signal
26992722
[`v8.setFlagsFromString()`]: v8.md#v8_v8_setflagsfromstring_flags
27002723
[debugger]: debugger.md
2724+
[deprecation code]: deprecations.md
27012725
[note on process I/O]: process.md#process_a_note_on_process_i_o
27022726
[process.cpuUsage]: #process_process_cpuusage_previousvalue
27032727
[process_emit_warning]: #process_process_emitwarning_warning_type_code_ctor

0 commit comments

Comments
 (0)