Remove Zod from named errors (#26982)

This commit is contained in:
Kit Langton
2026-05-12 09:20:15 -04:00
committed by GitHub
parent ea39af6f3b
commit 2296db6be8
20 changed files with 197 additions and 245 deletions
+3 -2
View File
@@ -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 : ""