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: correct description of assert.ifError() #2941

Closed
wants to merge 3 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Sep 18, 2015

This fixes a few typographical errors (comma splices and the like) and
corrects the description of assert.ifError().

@Trott Trott added assert Issues and PRs related to the assert subsystem. doc Issues and PRs related to the documentations. labels Sep 18, 2015

## 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
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oof, good point.

Copy link
Member Author

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...

Copy link
Member Author

Choose a reason for hiding this comment

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

Pushed a revision. Better?

@targos
Copy link
Member

targos commented Sep 18, 2015

LGTM with a suggestion

@thefourtheye
Copy link
Contributor

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.
@Trott
Copy link
Member Author

Trott commented Sep 18, 2015

Changed both instances of non-equality to inequality.

Trott added a commit to Trott/io.js that referenced this pull request Sep 19, 2015
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]>
@Trott
Copy link
Member Author

Trott commented Sep 19, 2015

Landed in 4fb4c14

@Trott Trott closed this Sep 19, 2015
Trott added a commit that referenced this pull request Sep 20, 2015
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]>
@rvagg rvagg mentioned this pull request Sep 22, 2015
@Trott Trott deleted the assert-comma-splice branch January 13, 2022 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants