Skip to content

Commit 5e234ac

Browse files
zuozp8eforksmcollinametcoder95
authored
docs: document about global dispatcher and errors (#3987) (#4014)
* docs about global dispatcher and errors (#3987) Signed-off-by: Konrad Baumgart <[email protected]> * Update docs/docs/api/Errors.md Co-authored-by: Carlos Fuentes <[email protected]> --------- Signed-off-by: Konrad Baumgart <[email protected]> Co-authored-by: Konrad Baumgart <[email protected]> Co-authored-by: Matteo Collina <[email protected]> Co-authored-by: Carlos Fuentes <[email protected]>
1 parent af0eee2 commit 5e234ac

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ See [Dispatcher.upgrade](./docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-
337337

338338
* dispatcher `Dispatcher`
339339

340-
Sets the global dispatcher used by Common API Methods.
340+
Sets the global dispatcher used by Common API Methods. Global dispatcher is shared among compatible undici modules,
341+
including undici that is bundled internally with node.js.
341342

342343
### `undici.getGlobalDispatcher()`
343344

docs/docs/api/Errors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { errors } from 'undici'
2828
| `ResponseExceededMaxSizeError` | `UND_ERR_RES_EXCEEDED_MAX_SIZE` | response body exceed the max size allowed |
2929
| `SecureProxyConnectionError` | `UND_ERR_PRX_TLS` | tls connection to a proxy failed |
3030

31+
Be aware of the possible difference between the global dispatcher version and the actual undici version you might be using. We recommend to avoid the check `instanceof errors.UndiciError` and seek for the `error.code === '<error_code>'` instead to avoid inconsistencies.
3132
### `SocketError`
3233

3334
The `SocketError` has a `.socket` property which holds socket metadata:

0 commit comments

Comments
 (0)