()
| 1371 | serializedResult = { |
| 1372 | __arrayBuffer: true, |
| 1373 | data: buffer.toString('base64'), |
| 1374 | byteLength: result.byteLength |
| 1375 | }; |
| 1376 | } |
| 1377 | |
| 1378 | ws.send(JSON.stringify({ |
| 1379 | id, |
| 1380 | type: 'result', |
| 1381 | result: serializedResult |
| 1382 | })); |
| 1383 | } else { |
| 1384 | throw new Error(`IPC handler '${channel}' not found`); |
| 1385 | } |
| 1386 | } |
| 1387 | } catch (error) { |
| 1388 | console.error('Error executing IPC call:', error); |
| 1389 | ws.send(JSON.stringify({ |
| 1390 | id, |
| 1391 | type: 'error', |
| 1392 | error: error.message || String(error) |
| 1393 | })); |
| 1394 | } |
| 1395 | } catch (error) { |
| 1396 | console.error('Error handling WebSocket message:', error); |
| 1397 | try { |
| 1398 | ws.send(JSON.stringify({ |
| 1399 | type: 'error', |
| 1400 | error: error.message |
| 1401 | })); |
| 1402 | } catch (_) { /* ignore */ } |
| 1403 | } finally { |
| 1404 | if (!isFireAndForget) { |
| 1405 | releaseWsIpcSlot(); |
no test coverage detected