Skip to content

Commit 52cd19a

Browse files
committed
Cleanup docs
1 parent b050ad9 commit 52cd19a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

API.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Throws the error passed if it matches any of the specified rules where:
8383
- `'system'` - matches any languange native error or node assertions.
8484
- `'boom'` - matches [**boom**](https://github.com/hapijs/boom) errors.
8585
- `'abort'` - matches an `AbortError`, as generated on an `AbortSignal` by `AbortController.abort()`.
86-
- `'timeout'` - matches an `TimeoutError`, as generated by `AbortSignal.timeout(delay)`.
86+
- `'timeout'` - matches a `TimeoutError`, as generated by `AbortSignal.timeout(delay)`.
8787
- an object where each property is compared with the error and must match the error property
8888
value. All the properties in the object must match the error but do not need to include all
8989
the error properties.
@@ -131,8 +131,14 @@ Return `true` when `err` is one of:
131131

132132
### `isAbort(err)`
133133

134-
Returns `true` when `err` is an `AbortError`, as generated on an `AbortSignal` by `AbortController.abort()`.
134+
Returns `true` when `err` is an `AbortError`, as generated by `AbortSignal.abort()`.
135+
136+
Note that unlike other errors, `AbortError` cannot be considered a class in itself.
137+
The best way to create a custom `AbortError` is with `new DOMException(message, 'AbortError')`.
135138

136139
### `isTimeout(err)`
137140

138-
Returns `true` when `err` is an `TimeoutError`, as generated by `AbortSignal.timeout(delay)`.
141+
Returns `true` when `err` is a `TimeoutError`, as generated by `AbortSignal.timeout(delay)`.
142+
143+
Note that unlike other errors, `TimeoutError` cannot be considered a class in itself.
144+
The best way to create a custom `TimeoutError` is with `new DOMException(message, 'TimeoutError')`.

0 commit comments

Comments
 (0)