-
-
Notifications
You must be signed in to change notification settings - Fork 17
fix(cli): handle error for proxy server #634
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
|
Claude finished @jiashengguo's task —— View job PR Review: Handle Error for Proxy ServerTodo List:
Review SummaryThis PR adds error handling for the Express server in the proxy action, specifically handling the ✅ Positives
🔍 Code Quality & Best PracticesFile: The implementation follows Node.js best practices:
|
📝 WalkthroughWalkthroughUpdates proxy startup behavior and defaults: adds an HTTP server 'error' handler that treats 'EADDRINUSE' specially (logs a red, user-friendly port-in-use message and exits with code 1; other errors throw CliError and exit 1), and changes the proxy command default port from 8008 to 2311. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds error handling for the proxy server to gracefully handle cases where the server fails to start, particularly when the port is already in use.
Changes:
- Added an 'error' event handler to the server that detects EADDRINUSE errors and provides a helpful message to the user
- Added fallback error handling for other server startup errors
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/cli/src/actions/proxy.ts`:
- Around line 169-178: The error handler in server.on('error', ...) currently
throws a CliError in the else branch which makes process.exit(1) unreachable and
will create an unhandled exception; replace the throw new CliError(...) with a
console.error that logs the error message (including err.message and context
like "Failed to start the server") so the handler always reaches
process.exit(1); reference the existing symbols: server.on('error', (err:
NodeJS.ErrnoException) => { ... }), the CliError type, err, and options.port to
build the error log.
|
Claude finished @jiashengguo's task —— View job PR Review: Handle Error for Proxy ServerTodo List:
Review SummaryThis PR adds error handling for the Express server in the proxy action, specifically handling the ✅ Positives
🔍 Code Quality & Best PracticesFile: The implementation follows Node.js best practices:
|
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.