Skip to content

#25: handle MCP startup failure with catch handler#37

Open
VasilevNStas wants to merge 8 commits into
zerocracy:masterfrom
VasilevNStas:25
Open

#25: handle MCP startup failure with catch handler#37
VasilevNStas wants to merge 8 commits into
zerocracy:masterfrom
VasilevNStas:25

Conversation

@VasilevNStas

@VasilevNStas VasilevNStas commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Problem:
The top-level IIFE in index.ts awaits server.connect() without a .catch() handler. On Node >=18, unhandled promise rejections terminate the process with no diagnostic output.

Solution:
Attach .catch() that logs the error context via console.error and exits with code 1. Add regression test that mocks server.connect rejection and asserts proper error reporting and exit.

Checklist:

  • npx eslint . — 0 errors
  • npx jest --coverage — all pass, coverage >=90%
  • npx tsc --target es2020 --module nodenext --outDir dist — 0 errors
  • make — lint + test + it + tsc pass

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 @edmoffo please review

@kreinba kreinba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attaching .catch() to the top-level IIFE logs the rejection and exits with a non-zero code, the new test mocks server.connect rejection and asserts console.error and process.exit calls, jest and eslint pass locally. Resolves #25. 0 inline comments.

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 @edmoffo please re-review

@VasilevNStas VasilevNStas changed the title #25: handle MCP startup failure with catch handler handle MCP startup failure with catch handler Jun 7, 2026
@VasilevNStas VasilevNStas changed the title handle MCP startup failure with catch handler #25: handle MCP startup failure with catch handler Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants