-
Notifications
You must be signed in to change notification settings - Fork 0
Improve error handling and logging in scenario execution #10
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
The server lacks comprehensive error handling and logging for scenario execution, making debugging difficult.
Current Issues
- No try-catch blocks around critical operations
- stderr is sent to client but not logged server-side
- No validation of Docker daemon availability
- Fixed 2-second delay for readiness instead of actual checks
- No cleanup on error conditions
Current Code Issues
// No error handling here:
const child = spawn('docker', args);
// Fixed delay instead of readiness check:
setTimeout(() => {
socket.emit('scenario-ready');
}, 2000);
// Limited error info:
child.on('error', (error) => {
socket.emit('output', `Error: ${error.message}\n`);
});Expected Behavior
- Comprehensive error logging on server
- Meaningful error messages to users
- Proper cleanup of failed containers
- Health checks for container readiness
- Graceful handling of Docker daemon issues
Solution
- Add try-catch blocks around spawn operations
- Implement proper logging (console.error at minimum)
- Add Docker daemon connectivity check on startup
- Replace fixed delays with actual readiness probes
- Ensure cleanup of resources on all error paths
Impact
- Difficult to debug issues in production
- Users see cryptic errors
- Potential resource leaks from unclean shutdowns
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request