doc: tidy AssertionError text

Several minor improvements to text. Remove some repetition.

PR-URL: https://github.com/nodejs/node/pull/28255
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Rich Trott 2019-06-16 15:46:59 -07:00
parent e3d5257ec3
commit 17a5eba6c2

View File

@ -21,33 +21,26 @@ thrown by the `assert` module will be instances of the `AssertionError` class.
added: v0.1.21 added: v0.1.21
--> -->
* `options` {Object} * `options` {Object}
* `message` {string} If provided, the error message is going to be set to this * `message` {string} If provided, the error message is set to this value.
value. * `actual` {any} The `actual` property on the error instance.
* `actual` {any} The `actual` property on the error instance is going to * `expected` {any} The `expected` property on the error instance.
contain this value. Internally used for the `actual` error input in case * `operator` {string} The `operator` property on the error instance.
e.g., [`assert.strictEqual()`] is used. * `stackStartFn` {Function} If provided, the generated stack trace omits
* `expected` {any} The `expected` property on the error instance is going to frames before this function.
contain this value. Internally used for the `expected` error input in case
e.g., [`assert.strictEqual()`] is used.
* `operator` {string} The `operator` property on the error instance is going
to contain this value. Internally used to indicate what operation was used
for comparison (or what assertion function triggered the error).
* `stackStartFn` {Function} If provided, the generated stack trace is going to
remove all frames up to the provided function.
A subclass of `Error` that indicates the failure of an assertion. A subclass of `Error` that indicates the failure of an assertion.
All instances contain the built-in `Error` properties (`message` and `name`) All instances contain the built-in `Error` properties (`message` and `name`)
and: and:
* `actual` {any} Set to the actual value in case e.g., * `actual` {any} Set to the `actual` argument for methods such as
[`assert.strictEqual()`] is used. [`assert.strictEqual()`].
* `expected` {any} Set to the expected value in case e.g., * `expected` {any} Set to the `expected` value for methods such as
[`assert.strictEqual()`] is used. [`assert.strictEqual()`].
* `generatedMessage` {boolean} Indicates if the message was auto-generated * `generatedMessage` {boolean} Indicates if the message was auto-generated
(`true`) or not. (`true`) or not.
* `code` {string} This is always set to the string `ERR_ASSERTION` to indicate * `code` {string} Value is always `ERR_ASSERTION` to show that the error is an
that the error is actually an assertion error. assertion error.
* `operator` {string} Set to the passed in operator value. * `operator` {string} Set to the passed in operator value.
```js ```js