Skip to content

Commit 6faf2cc

Browse files
chore(internal): show error causes in MCP servers when running in local mode
1 parent 91097e4 commit 6faf2cc

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
@@ -214,7 +214,8 @@ function makeSdkProxy<T extends object>(obj: T, { path, isBelievedBad = false }:
214214

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

0 commit comments

Comments
 (0)