Skip to content

Commit 4817d7e

Browse files
msukkariclaude
andcommitted
fix(web): handle unhandled promise rejections in tool_used captureEvent calls
Add .catch(() => {}) to all fire-and-forget captureEvent('tool_used') calls in adapters.ts and server.ts, matching the existing pattern in apiHandler.ts. Prevents unhandled promise rejections if telemetry fails. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 094cfe1 commit 4817d7e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/web/src/features/mcp/server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export async function createMcpServer(): Promise<McpServer> {
6262
toolName: 'list_language_models',
6363
source: 'sourcebot-mcp-server',
6464
success: true,
65-
});
65+
}).catch(() => {});
6666
return { content: [{ type: "text", text: JSON.stringify(models) }] };
6767
}
6868
);
@@ -111,7 +111,7 @@ export async function createMcpServer(): Promise<McpServer> {
111111
toolName: 'ask_codebase',
112112
source: 'sourcebot-mcp-server',
113113
success: false,
114-
});
114+
}).catch(() => {});
115115
return {
116116
content: [{ type: "text", text: `Failed to ask codebase: ${result.message}` }],
117117
};
@@ -121,7 +121,7 @@ export async function createMcpServer(): Promise<McpServer> {
121121
toolName: 'ask_codebase',
122122
source: 'sourcebot-mcp-server',
123123
success: true,
124-
});
124+
}).catch(() => {});
125125

126126
const formattedResponse = dedent`
127127
${result.answer}

packages/web/src/features/tools/adapters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function toVercelAITool<TName extends string, TShape extends z.ZodRawShap
2424
toolName: def.name,
2525
source: context.source ?? 'unknown',
2626
success,
27-
});
27+
}).catch(() => {});
2828
}
2929
},
3030
toModelOutput: ({ output }) => ({

0 commit comments

Comments
 (0)