fix: add error handling for server startup failures (#236)
Previously, if app.listen() failed (e.g., port already in use), the server would fail silently. This adds proper error handling to log the error and exit with a non-zero status code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8b09f4278c
commit
081dad83c4
1 changed files with 80 additions and 16 deletions
|
|
@ -54,7 +54,11 @@ export async function startServer(
|
|||
}
|
||||
});
|
||||
|
||||
const httpServer = app.listen(port, () => {
|
||||
const httpServer = app.listen(port, (err) => {
|
||||
if (err) {
|
||||
console.error("Failed to start server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`${name} listening on http://localhost:${port}/mcp`);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue