Merge pull request #33 from thisistonydang/thisistonydang/catch-error

Add catch block to prevent silent failure in example TypeScript MCP client (mcp-client-typescript)
This commit is contained in:
Jonathan Hefner 2025-12-12 09:39:00 -06:00 • committed by GitHub
commit c2cc47f5cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -183,6 +183,10 @@ async function main() {
try {
await mcpClient.connectToServer(process.argv[2]);
await mcpClient.chatLoop();
} catch (e) {
console.error("Error:", e);
await mcpClient.cleanup();
process.exit(1);
} finally {
await mcpClient.cleanup();
process.exit(0);