Skip to content

Commit 9231f9b

Browse files
committed
Include which endpoint failed in error
1 parent 886df0b commit 9231f9b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cli/src/utils/codebuff-api.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,15 @@ export function createCodebuffApiClient(
393393
continue
394394
}
395395

396-
// Don't retry, throw the error
396+
// Don't retry, throw the error with URL context
397+
if (error instanceof Error) {
398+
const enhancedError = new Error(
399+
`${error.message} (${method} ${url})`,
400+
)
401+
enhancedError.name = error.name
402+
enhancedError.cause = error
403+
throw enhancedError
404+
}
397405
throw error
398406
}
399407
}

packages/agent-runtime/src/llm-api/codebuff-web-api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const callCodebuffV1 = async (params: {
6868
body: JSON.stringify(payload),
6969
}),
7070
FETCH_TIMEOUT_MS,
71+
`Request to ${endpoint} timed out after ${FETCH_TIMEOUT_MS}ms`,
7172
)
7273

7374
const text = await res.text()
@@ -259,6 +260,7 @@ export async function callTokenCountAPI(params: {
259260
body: JSON.stringify(payload),
260261
}),
261262
FETCH_TIMEOUT_MS,
263+
`Request to /api/v1/token-count timed out after ${FETCH_TIMEOUT_MS}ms`,
262264
)
263265

264266
const text = await res.text()

0 commit comments

Comments
 (0)