summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJuan José Arboleda <soyjuanarbol@gmail.com>2019-09-08 13:30:07 -0500
committerRich Trott <rtrott@gmail.com>2019-09-22 18:30:06 -0700
commit68d6c4c661dd35c40f40a9c2957ac201c69f282d (patch)
treeb9abc66e5e03e38ccc82e08f49aa686b25e31ea7 /doc
parente573c39b889db13a1c3da14a5116a7615653cf6c (diff)
downloadandroid-node-v8-68d6c4c661dd35c40f40a9c2957ac201c69f282d.tar.gz
android-node-v8-68d6c4c661dd35c40f40a9c2957ac201c69f282d.tar.bz2
android-node-v8-68d6c4c661dd35c40f40a9c2957ac201c69f282d.zip
doc: add code example to process.throwDeprecation property
PR-URL: https://github.com/nodejs/node/pull/29495 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/process.md25
1 files changed, 21 insertions, 4 deletions
diff --git a/doc/api/process.md b/doc/api/process.md
index bbf0151e9b..cac35f2957 100644
--- a/doc/api/process.md
+++ b/doc/api/process.md
@@ -2224,11 +2224,28 @@ added: v0.9.12
* {boolean}
-The `process.throwDeprecation` property indicates whether the
-`--throw-deprecation` flag is set on the current Node.js process. See the
+The initial value of `process.throwDeprecation` indicates whether the
+`--throw-deprecation` flag is set on the current Node.js process.
+`process.throwDeprecation` is mutable, so whether or not deprecation
+warnings result in errors may be altered at runtime. See the
documentation for the [`'warning'` event][process_warning] and the
-[`emitWarning()` method][process_emit_warning] for more information about this
-flag's behavior.
+[`emitWarning()` method][process_emit_warning] for more information.
+
+```console
+$ node --throw-deprecation -p "process.throwDeprecation"
+true
+$ node -p "process.throwDeprecation"
+undefined
+$ node
+> process.emitWarning('test', 'DeprecationWarning');
+undefined
+> (node:26598) DeprecationWarning: test
+> process.throwDeprecation = true;
+true
+> process.emitWarning('test', 'DeprecationWarning');
+Thrown:
+{ [DeprecationWarning: test] name: 'DeprecationWarning' }
+```
## process.title
<!-- YAML