mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
tweak: show actual retry error message instead of generic error msg (#11520)
This commit is contained in:
@@ -89,13 +89,7 @@ export namespace SessionRetry {
|
||||
if (json.type === "error" && json.error?.code?.includes("rate_limit")) {
|
||||
return "Rate Limited"
|
||||
}
|
||||
if (
|
||||
json.error?.message?.includes("no_kv_space") ||
|
||||
(json.type === "error" && json.error?.type === "server_error") ||
|
||||
!!json.error
|
||||
) {
|
||||
return "Provider Server Error"
|
||||
}
|
||||
return JSON.stringify(json)
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ describe("session.retry.retryable", () => {
|
||||
|
||||
test("handles json messages without code", () => {
|
||||
const error = wrap(JSON.stringify({ error: { message: "no_kv_space" } }))
|
||||
expect(SessionRetry.retryable(error)).toBe("Provider Server Error")
|
||||
expect(SessionRetry.retryable(error)).toBe(`{"error":{"message":"no_kv_space"}}`)
|
||||
})
|
||||
|
||||
test("does not throw on numeric error codes", () => {
|
||||
|
||||
Reference in New Issue
Block a user