Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8ef629a

Browse filesBrowse 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 <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 1916acb commit 8ef629a
Copy full SHA for 8ef629a

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Open diff view settings
Collapse file

‎doc/api/assert.md‎

Copy file name to clipboardExpand all lines: doc/api/assert.md
+7-7Lines changed: 7 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.