Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add code example to process.throwDeprecation property #29495

Closed
wants to merge 4 commits into from

Conversation

juanarbol
Copy link
Member

Checklist

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. process Issues and PRs related to the process subsystem. labels Sep 8, 2019
true
$ node -p "process.throwDeprecation"
undefined
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thrown

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally worth it!

Copy link
Member Author

@juanarbol juanarbol Sep 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be good, I think

@danbev
Copy link
Contributor

danbev commented Sep 12, 2019

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
Copy link
Member

@Trott Trott Sep 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Trott previously requested changes Sep 18, 2019
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the text edited a bit more before landing.

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`--throw-deprecation` flag is set on the current Node.js process,
`--throw-deprecation` flag is set on the current Node.js process.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
warnings results in an error may be altered at runtime. See the
warnings result in errors may be altered at runtime. See the

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott, Thanks! Fixed on a6d19ba

@Trott Trott dismissed their stale review September 23, 2019 01:09

thanks for editing!

@Trott
Copy link
Member

Trott commented Sep 23, 2019

Trott pushed a commit that referenced this pull request Sep 23, 2019
PR-URL: #29495
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@Trott
Copy link
Member

Trott commented Sep 23, 2019

Landed in 68d6c4c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants