diff options
author | 2023-01-07 23:47:08 -0800 | |
---|---|---|
committer | 2023-01-07 23:47:08 -0800 | |
commit | 3c8701362bee0c1cc8ececd0f1a87c1665376a24 (patch) | |
tree | 51b2c9e2ff116fb454c8276d4268d73ad8df3d7e | |
parent | fadd1c0152ebce389f7d8fa0c297208cd71ff5c0 (diff) | |
download | bun-3c8701362bee0c1cc8ececd0f1a87c1665376a24.tar.gz bun-3c8701362bee0c1cc8ececd0f1a87c1665376a24.tar.zst bun-3c8701362bee0c1cc8ececd0f1a87c1665376a24.zip |
Document `connectError`
-rw-r--r-- | packages/bun-types/bun.d.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index e3cea4644..9dbc8ba10 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -2736,6 +2736,21 @@ declare module "bun" { error?(socket: Socket<Data>, error: Error): void | Promise<void>; data?(socket: Socket<Data>, data: BufferSource): void | Promise<void>; drain?(socket: Socket<Data>): void | Promise<void>; + + /** + * When the socket fails to be created, this function is called. + * + * The promise returned by `Bun.connect` rejects **after** this function is + * called. + * + * When `connectError` is specified, the rejected promise will not be + * added to the promise rejection queue (so it won't be reported as an + * unhandled promise rejection, since connectError handles it). + * + * When `connectError` is not specified, the rejected promise will be added + * to the promise rejection queue. + */ + connectError?(error: Error): void | Promise<void>; } interface SocketOptions<Data = unknown> { |