From d4c6b2337d402e5fe81e60cd475e2c75a68a8047 Mon Sep 17 00:00:00 2001 From: Mandeep Singh Date: Sun, 16 Jul 2017 11:32:04 +0530 Subject: [PATCH 1/2] doc: add docs for AssertionError Fixes: https://github.com/nodejs/node/issues/12274 --- doc/api/errors.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/api/errors.md b/doc/api/errors.md index b5869c16d1848c..453b1637698b3d 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -358,6 +358,18 @@ loop tick. System-level errors are generated as augmented `Error` instances, which are detailed [here](#errors_system_errors). +## Class: AssertionError + +A subclass of `Error` that indicates the failure of an assertion. Such errors +commonly indicate inequality of actual and expected parameters. + +For example: + +```js +assert.equal(1, 2); +// AssertionError [ERR_ASSERTION]: 1 == 2 +``` + ## Class: RangeError A subclass of `Error` that indicates that a provided argument was not within the From 3958388d341857878522f6e49db1a7850efb4d21 Mon Sep 17 00:00:00 2001 From: Mandeep Singh Date: Sun, 16 Jul 2017 19:13:11 +0530 Subject: [PATCH 2/2] doc: use strictEqual instead of equal --- doc/api/errors.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 453b1637698b3d..eabd312c6cd0c7 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -366,8 +366,8 @@ commonly indicate inequality of actual and expected parameters. For example: ```js -assert.equal(1, 2); -// AssertionError [ERR_ASSERTION]: 1 == 2 +assert.strictEqual(1, 2); +// AssertionError [ERR_ASSERTION]: 1 === 2 ``` ## Class: RangeError