Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to logging of errors from WS #15900

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/kernels/common/kernelSocketWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,16 @@ export function KernelSocketWrapper<T extends ClassType<IWebSocketLike>>(SuperCl
}

public override emit(event: string | symbol, ...args: any[]): boolean {
if (event === 'unexpected-response' || event === 'error') {
logger.error(`Error in websocket: ${JSON.stringify(args)}`);
if (event === 'unexpected-response' && args.length === 2) {
const response: Record<string, any> | undefined = args[1];
logger.error(
`Error in websocket: (${response?.statusCode}) ${response?.statusMessage}, ${response?.path}, Headers = ${JSON.stringify(
response?.headers
)}`
);
}
if (event === 'error') {
logger.error(`Error in websocket`, args.length ? args[0] : undefined);
}
return this.handleEvent((ev, ...args) => super.emit(ev, ...args), event, ...args);
}
Expand Down
Loading