-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: correct description of assert.ifError() #2941
Conversation
|
||
## assert.ifError(value) | ||
|
||
Tests if value is not a false value, throws if it is a true value. Useful when | ||
testing the first argument, `error` in callbacks. | ||
Tests if value is an `Error` and, if so, throws it. This is useful when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't actually check if it is an Error
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, good point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original text is correct, just kind of worded in a way that's easy to misunderstand. throws if it is a true value
makes it sound like it throws an error if the value is true. But what it actually does is it throws the value itself, as long as it is truthy. I'll attempt a re-wording that won't make it WRONG...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed a revision. Better?
LGTM with a suggestion |
LGTM - targo's suggestion. |
This fixes a few typographical errors (comma splices and the like) and corrects the description of assert.ifError().
It throws if `value` is truthy.
9499062
to
7c4a8f3
Compare
Changed both instances of |
This fixes a few typographical errors (comma splices and the like) and clarifies the description of assert.ifError(). It also standardizes the document on "inequality" rather than having both "inequality" and "non- equality". PR-URL: nodejs#2941 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Landed in 4fb4c14 |
This fixes a few typographical errors (comma splices and the like) and clarifies the description of assert.ifError(). It also standardizes the document on "inequality" rather than having both "inequality" and "non- equality". PR-URL: #2941 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
This fixes a few typographical errors (comma splices and the like) and
corrects the description of assert.ifError().