-
Notifications
You must be signed in to change notification settings - Fork 0
Improve Error Handling in Code Runner #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add CodeExecutionError class with error types (network, timeout, simulation, unknown) - Implement timeout mechanism (30s default) to prevent hanging executions - Add retry logic with exponential backoff (up to 2 retries by default) - Better error categorization and user-friendly error messages - Enhanced progress tracking during execution and retries - Improved console output with emojis and contextual messages
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
User description
This PR enhances error handling in the useCodeRunner hook to provide better user experience and more robust code execution.
Changes
Benefits
Closes #42
PR Type
Enhancement, Bug fix
Description
Add CodeExecutionError class with error type categorization (network, timeout, simulation, unknown)
Implement 30-second timeout mechanism to prevent hanging code executions
Add automatic retry logic with exponential backoff (up to 2 retries)
Enhance error messages with contextual hints and user-friendly formatting
Improve progress tracking and console output with emoji indicators
Add configurable timeout and retry options to useCodeRunner hook
Diagram Walkthrough
flowchart LR A["Code Execution Request"] --> B["Timeout Promise Race"] B --> C{"Execution Success?"} C -->|Yes| D["Return Results"] C -->|No| E["Categorize Error"] E --> F{"Retries Remaining?"} F -->|Yes| G["Exponential Backoff"] G --> B F -->|No| H["Report Final Error"] D --> I["User Feedback"] H --> IFile Walkthrough
useCodeRunner.ts
Enhanced error handling with timeout and retry logicsrc/lib/hooks/useCodeRunner.ts
timeout, simulation, unknown)
duration (default 30s)
default)
tracking