Remove Zod from named errors (#26982)
This commit is contained in:
@@ -2,6 +2,7 @@ import type { NamedError } from "@opencode-ai/core/util/error"
|
||||
import { Cause, Clock, Duration, Effect, Schedule } from "effect"
|
||||
import { MessageV2 } from "./message-v2"
|
||||
import { iife } from "@/util/iife"
|
||||
import { isRecord } from "@/util/record"
|
||||
|
||||
export type Err = ReturnType<NamedError["toObject"]>
|
||||
|
||||
@@ -121,7 +122,7 @@ export function retryable(error: Err, provider: string) {
|
||||
}
|
||||
|
||||
// Check for rate limit patterns in plain text error messages
|
||||
const msg = error.data?.message
|
||||
const msg = isRecord(error.data) ? error.data.message : undefined
|
||||
if (typeof msg === "string") {
|
||||
const lower = msg.toLowerCase()
|
||||
if (
|
||||
@@ -133,7 +134,7 @@ export function retryable(error: Err, provider: string) {
|
||||
}
|
||||
}
|
||||
|
||||
const json = parseJSON(error.data?.message)
|
||||
const json = parseJSON(msg)
|
||||
if (!json || typeof json !== "object") return undefined
|
||||
const code = typeof json.code === "string" ? json.code : ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user