Skip to content

Commit c2cc47f

Browse files
Merge pull request #33 from thisistonydang/thisistonydang/catch-error
Add catch block to prevent silent failure in example TypeScript MCP client (mcp-client-typescript)
2 parents 477d7d7 + 083ce1d commit c2cc47f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mcp-client-typescript/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ async function main() {
183183
try {
184184
await mcpClient.connectToServer(process.argv[2]);
185185
await mcpClient.chatLoop();
186+
} catch (e) {
187+
console.error("Error:", e);
188+
await mcpClient.cleanup();
189+
process.exit(1);
186190
} finally {
187191
await mcpClient.cleanup();
188192
process.exit(0);

0 commit comments

Comments
 (0)