Skip to content

Commit

Permalink
Cleanup docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kanongil committed Oct 23, 2024
1 parent 3d130e7 commit 189747a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Throws the error passed if it matches any of the specified rules where:
- `'system'` - matches any languange native error or node assertions.
- `'boom'` - matches [**boom**](https://github.com/hapijs/boom) errors.
- `'abort'` - matches an `AbortError`, as generated on an `AbortSignal` by `AbortController.abort()`.
- `'timeout'` - matches an `TimeoutError`, as generated by `AbortSignal.timeout(delay)`.
- `'timeout'` - matches a `TimeoutError`, as generated by `AbortSignal.timeout(delay)`.
- an object where each property is compared with the error and must match the error property
value. All the properties in the object must match the error but do not need to include all
the error properties.
Expand Down Expand Up @@ -131,8 +131,14 @@ Return `true` when `err` is one of:

### `isAbort(err)`

Returns `true` when `err` is an `AbortError`, as generated on an `AbortSignal` by `AbortController.abort()`.
Returns `true` when `err` is an `AbortError`, as generated by `AbortSignal.abort()`.

Note that unlike other errors, `AbortError` cannot be considered a class in itself.
The best way to create a custom `AbortError` is with `new DOMException(message, 'AbortError')`.

### `isTimeout(err)`

Returns `true` when `err` is an `TimeoutError`, as generated by `AbortSignal.timeout(delay)`.
Returns `true` when `err` is a `TimeoutError`, as generated by `AbortSignal.timeout(delay)`.

Note that unlike other errors, `TimeoutError` cannot be considered a class in itself.
The best way to create a custom `TimeoutError` is with `new DOMException(message, 'TimeoutError')`.

0 comments on commit 189747a

Please sign in to comment.