Skip to content

Commit 083ce1d

Browse files
add catch block
1 parent dfc9247 commit 083ce1d

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
@@ -184,6 +184,10 @@ async function main() {
184184
try {
185185
await mcpClient.connectToServer(process.argv[2]);
186186
await mcpClient.chatLoop();
187+
} catch (e) {
188+
console.error("Error:", e);
189+
await mcpClient.cleanup();
190+
process.exit(1);
187191
} finally {
188192
await mcpClient.cleanup();
189193
process.exit(0);

0 commit comments

Comments
 (0)