Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: add docs for AssertionError
Fixes: #12274
  • Loading branch information
Mandeep Singh committed Jul 16, 2017
commit d4c6b2337d402e5fe81e60cd475e2c75a68a8047
12 changes: 12 additions & 0 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this could as well be "values" instead of "parameters", still LGTM.


For example:

```js
assert.equal(1, 2);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend using strictEqual() here to help set readers up for success :-)

// AssertionError [ERR_ASSERTION]: 1 == 2
```

## Class: RangeError

A subclass of `Error` that indicates that a provided argument was not within the
Expand Down