method

bun.SocketHandler.connectError

socket: Socket<Data>,
error: Error
): void | Promise<void>;

Called when the socket fails to be created.

The promise returned by Bun.connect rejects after this function is called.

When connectError is specified, the rejected promise is not added to the promise rejection queue (so it isn't reported as an unhandled promise rejection, since connectError handles it).

When connectError is not specified, the rejected promise is added to the promise rejection queue.

Referenced types

interface Error