diff options
author | Rich Trott <rtrott@gmail.com> | 2019-11-20 06:53:45 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-11-22 11:38:50 -0800 |
commit | b703218f780f25cf122cdd3825d06f5e30933eb2 (patch) | |
tree | 7225b2a05fc591e8f1e0033a75863b047d4aef8a /doc | |
parent | f17111280e34756c4c8a2d5e7825379baff78e78 (diff) | |
download | android-node-v8-b703218f780f25cf122cdd3825d06f5e30933eb2.tar.gz android-node-v8-b703218f780f25cf122cdd3825d06f5e30933eb2.tar.bz2 android-node-v8-b703218f780f25cf122cdd3825d06f5e30933eb2.zip |
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/assert.md | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/api/assert.md b/doc/api/assert.md index d27094fec5..fa9416ea73 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -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' @@ -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 |