From 083ce1d18b39648d6ece6ec7221df86a2254ebbe Mon Sep 17 00:00:00 2001 From: Tony Dang Date: Fri, 9 May 2025 09:03:58 -0700 Subject: [PATCH] add catch block --- mcp-client-typescript/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mcp-client-typescript/index.ts b/mcp-client-typescript/index.ts index be89f65..222c416 100644 --- a/mcp-client-typescript/index.ts +++ b/mcp-client-typescript/index.ts @@ -184,6 +184,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);