Skip to content

Commit

Permalink
docs about global dispatcher and errors (nodejs#3987)
Browse files Browse the repository at this point in the history
Signed-off-by: Konrad Baumgart <[email protected]>
  • Loading branch information
eforks committed Jan 19, 2025
1 parent 83537aa commit c00e498
Show file tree
Hide file tree
Showing 2 changed files with 5 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
3 changes: 3 additions & 0 deletions docs/docs/api/Errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ 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 that some errors are created by dispatcher. If you plan to check `instanceof errors.UndiciError` then don't use the default global dispatcher,
as it may come from another `undici` module and have its own errors classes.

### `SocketError`

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

0 comments on commit c00e498

Please sign in to comment.