diff --git a/src/kernels/common/kernelSocketWrapper.ts b/src/kernels/common/kernelSocketWrapper.ts index d9889fa627c..f802faba792 100644 --- a/src/kernels/common/kernelSocketWrapper.ts +++ b/src/kernels/common/kernelSocketWrapper.ts @@ -110,8 +110,16 @@ export function KernelSocketWrapper>(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 | 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); }