#25: handle MCP startup failure with catch handler#37
Open
VasilevNStas wants to merge 8 commits into
Open
Conversation
Contributor
Author
kreinba
approved these changes
Jun 5, 2026
kreinba
left a comment
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
The top-level IIFE in
index.tsawaitsserver.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 viaconsole.errorand exits with code 1. Add regression test that mocksserver.connectrejection and asserts proper error reporting and exit.Checklist:
npx eslint .— 0 errorsnpx jest --coverage— all pass, coverage >=90%npx tsc --target es2020 --module nodenext --outDir dist— 0 errorsmake— lint + test + it + tsc pass