Add WebSocket error handling with stack traces

Wrapped ws.onmessage in try-catch to capture full stack trace
when errors occur during message handling. This will help identify
where the 'Cannot read properties of undefined' error is coming from.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-07 23:33:07 -05:00
parent 06eb2d2593
commit 9b31b7619f

View File

@@ -2458,6 +2458,7 @@
ws = new WebSocket(`${protocol}//${window.location.host}`); ws = new WebSocket(`${protocol}//${window.location.host}`);
ws.onmessage = (event) => { ws.onmessage = (event) => {
try {
const data = JSON.parse(event.data); const data = JSON.parse(event.data);
console.log('WebSocket message:', data); console.log('WebSocket message:', data);
@@ -2525,6 +2526,10 @@
if (!['command_result', 'workflow_result', 'worker_update', 'execution_started', 'execution_status', 'workflow_created', 'workflow_deleted'].includes(data.type)) { if (!['command_result', 'workflow_result', 'worker_update', 'execution_started', 'execution_status', 'workflow_created', 'workflow_deleted'].includes(data.type)) {
refreshData(); refreshData();
} }
} catch (error) {
console.error('Error handling WebSocket message:', error);
console.error('Stack trace:', error.stack);
}
}; };
ws.onclose = () => { ws.onclose = () => {