Skip to content

Commit

Permalink
doc: add code example to process.throwDeprecation property
Browse files Browse the repository at this point in the history
PR-URL: #29495
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
juanarbol authored and BridgeAR committed Sep 25, 2019
1 parent 123437b commit 2707beb
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2707beb

Please sign in to comment.