Skip to content

Commit

Permalink
docs: document about global dispatcher and errors (#3987) (#4014)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
4 people authored Jan 24, 2025
1 parent af0eee2 commit 5e234ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ See [Dispatcher.upgrade](./docs/docs/api/Dispatcher.md#dispatcherupgradeoptions-

* dispatcher `Dispatcher`

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

### `undici.getGlobalDispatcher()`

Expand Down
1 change: 1 addition & 0 deletions docs/docs/api/Errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { errors } from 'undici'
| `ResponseExceededMaxSizeError` | `UND_ERR_RES_EXCEEDED_MAX_SIZE` | response body exceed the max size allowed |
| `SecureProxyConnectionError` | `UND_ERR_PRX_TLS` | tls connection to a proxy failed |

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.
### `SocketError`

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

0 comments on commit 5e234ac

Please sign in to comment.