Skip to content

Commit 05e8d17

Browse files
committed
feat: improve error handling in authentication process to preserve original WebSocketQueryError
1 parent 8a06e15 commit 05e8d17

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nodejs/src/client/wsConnectionManager.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,14 @@ export class ConnectionManager {
389389
throw new WebSocketQueryError(result.msg.code, result.msg.message);
390390
}
391391
} catch (e: any) {
392-
// Auth failure — don't retry this host
392+
// If it's already a WebSocketQueryError, preserve the original error
393+
if (e instanceof WebSocketQueryError) {
394+
throw e;
395+
}
396+
// For other errors, wrap as authentication failure
393397
throw new TDWebSocketClientError(
394398
ErrorCode.ERR_WEBSOCKET_CONNECTION_FAIL,
395-
`Authentication failed: ${e.message}`
399+
`Authentication failed: ${e.message || e}`
396400
);
397401
}
398402
}

0 commit comments

Comments
 (0)