Skip to content

Commit

Permalink
doc: simplify "is recommended" language in assert documentation
Browse files Browse the repository at this point in the history
Replace "X is not recommended" with  "Avoid X".
Replace "It is recommended not to use X" with "Avoid X".

PR-URL: #30558
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
Trott authored and addaleax committed Nov 30, 2019
1 parent 1916acb commit 8ef629a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -1243,11 +1243,11 @@ assert.throws(
(err) => {
assert(err instanceof Error);
assert(/value/.test(err));
// Returning anything from validation functions besides `true` is not
// recommended. By doing that, it's not clear what part of the validation
// failed. Instead, throw an error about the specific validation that failed
// (as done in this example) and add as much helpful debugging information
// to that error as possible.
// Avoid returning anything from validation functions besides `true`.
// Otherwise, it's not clear what part of the validation failed. Instead,
// throw an error about the specific validation that failed (as done in this
// example) and add as much helpful debugging information to that error as
// possible.
return true;
},
'unexpected error'
Expand Down Expand Up @@ -1294,8 +1294,8 @@ assert.throws(throwingFirst, /Second$/);
// AssertionError [ERR_ASSERTION]
```

Due to the confusing notation, it is recommended not to use a string as the
second argument. This might lead to difficult-to-spot errors.
Due to the confusing error-prone notation, avoid a string as the second
argument.

[`AssertionError`]: #assert_class_assert_assertionerror
[`Class`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
Expand Down

0 comments on commit 8ef629a

Please sign in to comment.