doc: add code example to process.throwDeprecation property#29495
doc: add code example to process.throwDeprecation property#29495juanarbol wants to merge 4 commits intonodejs:masterfrom
Conversation
| true | ||
| $ node -p "process.throwDeprecation" | ||
| undefined | ||
| ``` |
There was a problem hiding this comment.
It may be worthwhile to include an example that shows process.throwDeprecation is mutable at runtime...
process.throwDeprecation = true;
process.emitWarning('test', 'DeprecationWarning');
// will cause an error to be thrownThere was a problem hiding this comment.
Should docs change? I mean, may say that process. throwDeprecation is mutable at runtime like: "The process.throwDeprecation is a mutable property at runtime which indicates...". And of course, add your example
doc/api/process.md
Outdated
| documentation for the [`'warning'` event][process_warning] and the | ||
| [`emitWarning()` method][process_emit_warning] for more information about this | ||
| flag's behavior. | ||
| The `process.throwDeprecation` is a mutable property at runtime which |
There was a problem hiding this comment.
This text is a little confusing.
- It's not clear what the difference between "mutable property at runtime" vs. "mutable property" would be. I don't think there is any in this case.
- Since it is mutable, it doesn't necessarily indicate whether the command line flag is set.
Maybe something more like this?
The initial value of `process.throwDeprecation` indicates whether the
`--throw-deprecation` flag is set on the current Node.js process. See
the documentation for the [`'warning'` event][process_warning] and the
[`emitWarning()` method][process_emit_warning] for more information.
`process.throwDeprecation` is mutable, so whether or not deprecation
warnings results in an error may be altered at runtime. There was a problem hiding this comment.
Yeap, that's quite confusing.
Your proposal seems to be more clear than mine (on my opinion), but on my reading experience, I think is quite better switch the order of the sentences about process.throwDeprecation property and emitWarning() and warning event, to make that paragraph with a little bit more of cohesion.
Fixed on bf3bcf7.
Trott
left a comment
There was a problem hiding this comment.
I'd like to see the text edited a bit more before landing.
doc/api/process.md
Outdated
| 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, |
There was a problem hiding this comment.
| `--throw-deprecation` flag is set on the current Node.js process, | |
| `--throw-deprecation` flag is set on the current Node.js process. |
doc/api/process.md
Outdated
| 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 results in an error may be altered at runtime. See the |
There was a problem hiding this comment.
| warnings results in an error may be altered at runtime. See the | |
| warnings result in errors may be altered at runtime. See the |
PR-URL: #29495 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 68d6c4c |
PR-URL: #29495 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #29495 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist