Skip to content

Commit 8ef629a

Browse files
Trottaddaleax
authored andcommitted
doc: simplify "is recommended" language in assert documentation
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]>
1 parent 1916acb commit 8ef629a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/api/assert.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1243,11 +1243,11 @@ assert.throws(
12431243
(err) => {
12441244
assert(err instanceof Error);
12451245
assert(/value/.test(err));
1246-
// Returning anything from validation functions besides `true` is not
1247-
// recommended. By doing that, it's not clear what part of the validation
1248-
// failed. Instead, throw an error about the specific validation that failed
1249-
// (as done in this example) and add as much helpful debugging information
1250-
// to that error as possible.
1246+
// Avoid returning anything from validation functions besides `true`.
1247+
// Otherwise, it's not clear what part of the validation failed. Instead,
1248+
// throw an error about the specific validation that failed (as done in this
1249+
// example) and add as much helpful debugging information to that error as
1250+
// possible.
12511251
return true;
12521252
},
12531253
'unexpected error'
@@ -1294,8 +1294,8 @@ assert.throws(throwingFirst, /Second$/);
12941294
// AssertionError [ERR_ASSERTION]
12951295
```
12961296

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

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

0 commit comments

Comments
 (0)