Skip to content

Commit c00e498

Browse files
committed
docs about global dispatcher and errors (nodejs#3987)
Signed-off-by: Konrad Baumgart <[email protected]>
1 parent 83537aa commit c00e498

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

+2-1
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

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ 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 that some errors are created by dispatcher. If you plan to check `instanceof errors.UndiciError` then don't use the default global dispatcher,
32+
as it may come from another `undici` module and have its own errors classes.
33+
3134
### `SocketError`
3235

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

0 commit comments

Comments
 (0)