Skip to content

Commit 7f1ff53

Browse files
chore(internal): show error causes in MCP servers when running in local mode
1 parent e2cf4dc commit 7f1ff53

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/mcp-server/src/code-tool-worker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ function makeSdkProxy<T extends object>(obj: T, { path, isBelievedBad = false }:
233233

234234
function parseError(code: string, error: unknown): string | undefined {
235235
if (!(error instanceof Error)) return;
236-
const message = error.name ? `${error.name}: ${error.message}` : error.message;
236+
const cause = error.cause instanceof Error ? `: ${error.cause.message}` : '';
237+
const message = error.name ? `${error.name}: ${error.message}${cause}` : `${error.message}${cause}`;
237238
try {
238239
// Deno uses V8; the first "<anonymous>:LINE:COLUMN" is the top of stack.
239240
const lineNumber = error.stack?.match(/<anonymous>:([0-9]+):[0-9]+/)?.[1];

0 commit comments

Comments
 (0)