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:
commit
c2cc47f5cd
1 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue