Skip to content

Commit 48f2078

Browse files
authoredApr 30, 2023
docs: updated Error documentation (fixes nodejs#2090) (nodejs#2092)
1 parent 3c514d8 commit 48f2078

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed
 

‎docs/api/Errors.md

+19-13
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@ You can find all the error objects inside the `errors` key.
77
import { errors } from 'undici'
88
```
99

10-
| Error | Error Codes | Description |
11-
| ------------------------------------ | ------------------------------------- | -------------------------------------------------- |
12-
| `InvalidArgumentError` | `UND_ERR_INVALID_ARG` | passed an invalid argument. |
13-
| `InvalidReturnValueError` | `UND_ERR_INVALID_RETURN_VALUE` | returned an invalid value. |
14-
| `RequestAbortedError` | `UND_ERR_ABORTED` | the request has been aborted by the user |
15-
| `ClientDestroyedError` | `UND_ERR_DESTROYED` | trying to use a destroyed client. |
16-
| `ClientClosedError` | `UND_ERR_CLOSED` | trying to use a closed client. |
17-
| `SocketError` | `UND_ERR_SOCKET` | there is an error with the socket. |
18-
| `NotSupportedError` | `UND_ERR_NOT_SUPPORTED` | encountered unsupported functionality. |
19-
| `RequestContentLengthMismatchError` | `UND_ERR_REQ_CONTENT_LENGTH_MISMATCH` | request body does not match content-length header |
20-
| `ResponseContentLengthMismatchError` | `UND_ERR_RES_CONTENT_LENGTH_MISMATCH` | response body does not match content-length header |
21-
| `InformationalError` | `UND_ERR_INFO` | expected error with reason |
22-
| `ResponseExceededMaxSizeError` | `UND_ERR_RES_EXCEEDED_MAX_SIZE` | response body exceed the max size allowed |
10+
| Error | Error Codes | Description |
11+
| ------------------------------------ | ------------------------------------- | ------------------------------------------------------------------------- |
12+
| `UndiciError` | `UND_ERR` | all errors below are extended from `UndiciError`. |
13+
| `ConnectTimeoutError` | `UND_ERR_CONNECT_TIMEOUT` | socket is destroyed due to connect timeout. |
14+
| `HeadersTimeoutError` | `UND_ERR_HEADERS_TIMEOUT` | socket is destroyed due to headers timeout. |
15+
| `HeadersOverflowError` | `UND_ERR_HEADERS_OVERFLOW` | socket is destroyed due to headers' max size being exceeded. |
16+
| `BodyTimeoutError` | `UND_ERR_BODY_TIMEOUT` | socket is destroyed due to body timeout. |
17+
| `ResponseStatusCodeError` | `UND_ERR_RESPONSE_STATUS_CODE` | an error is thrown when `throwOnError` is `true` for status codes >= 400. |
18+
| `InvalidArgumentError` | `UND_ERR_INVALID_ARG` | passed an invalid argument. |
19+
| `InvalidReturnValueError` | `UND_ERR_INVALID_RETURN_VALUE` | returned an invalid value. |
20+
| `RequestAbortedError` | `UND_ERR_ABORTED` | the request has been aborted by the user |
21+
| `ClientDestroyedError` | `UND_ERR_DESTROYED` | trying to use a destroyed client. |
22+
| `ClientClosedError` | `UND_ERR_CLOSED` | trying to use a closed client. |
23+
| `SocketError` | `UND_ERR_SOCKET` | there is an error with the socket. |
24+
| `NotSupportedError` | `UND_ERR_NOT_SUPPORTED` | encountered unsupported functionality. |
25+
| `RequestContentLengthMismatchError` | `UND_ERR_REQ_CONTENT_LENGTH_MISMATCH` | request body does not match content-length header |
26+
| `ResponseContentLengthMismatchError` | `UND_ERR_RES_CONTENT_LENGTH_MISMATCH` | response body does not match content-length header |
27+
| `InformationalError` | `UND_ERR_INFO` | expected error with reason |
28+
| `ResponseExceededMaxSizeError` | `UND_ERR_RES_EXCEEDED_MAX_SIZE` | response body exceed the max size allowed |
2329

2430
### `SocketError`
2531

0 commit comments

Comments
 (0)
Please sign in to comment.