Skip to content

websocket: pass failure cause through to error event#4996

Open
chrmarti wants to merge 1 commit intonodejs:mainfrom
chrmarti:fix/websocket-error-cause
Open

websocket: pass failure cause through to error event#4996
chrmarti wants to merge 1 commit intonodejs:mainfrom
chrmarti:fix/websocket-error-cause

Conversation

@chrmarti
Copy link
Copy Markdown

@chrmarti chrmarti commented Apr 8, 2026

The cause parameter in failWebsocketConnection was not being passed
through to onSocketClose, resulting in the TypeError fired in the
error event missing its cause property (e.g., the ECONNREFUSED error).

Pass the cause as an argument through onSocketClose to #onSocketClose
so that the TypeError is created with { cause } when available.

Fixes #4991

The cause parameter in failWebsocketConnection was not being passed
through to onSocketClose, resulting in the TypeError fired in the
error event missing its cause property (e.g., the ECONNREFUSED error).

Pass the cause as an argument through onSocketClose to #onSocketClose
so that the TypeError is created with { cause } when available.

Fixes: nodejs#4991
@chrmarti chrmarti marked this pull request as ready for review April 8, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebSocket: Network error cause missing

1 participant