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:
@@ -2458,8 +2458,9 @@
|
||||
ws = new WebSocket(`${protocol}//${window.location.host}`);
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
console.log('WebSocket message:', data);
|
||||
try {
|
||||
const data = JSON.parse(event.data);
|
||||
console.log('WebSocket message:', data);
|
||||
|
||||
// Handle specific message types
|
||||
if (data.type === 'command_result') {
|
||||
@@ -2521,9 +2522,13 @@
|
||||
loadWorkflows();
|
||||
}
|
||||
|
||||
// Generic refresh for other message types
|
||||
if (!['command_result', 'workflow_result', 'worker_update', 'execution_started', 'execution_status', 'workflow_created', 'workflow_deleted'].includes(data.type)) {
|
||||
refreshData();
|
||||
// Generic refresh for other message types
|
||||
if (!['command_result', 'workflow_result', 'worker_update', 'execution_started', 'execution_status', 'workflow_created', 'workflow_deleted'].includes(data.type)) {
|
||||
refreshData();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error handling WebSocket message:', error);
|
||||
console.error('Stack trace:', error.stack);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user