| 325 | } |
| 326 | |
| 327 | function extractCodexError(error: unknown): { message: string; code?: string } { |
| 328 | const anyError = error as any |
| 329 | const message = |
| 330 | anyError?.data?.message || |
| 331 | anyError?.errorText || |
| 332 | anyError?.message || |
| 333 | anyError?.error || |
| 334 | String(error) |
| 335 | const code = anyError?.data?.code || anyError?.code |
| 336 | |
| 337 | return { |
| 338 | message: typeof message === "string" ? message : String(message), |
| 339 | code: typeof code === "string" ? code : undefined, |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | function isCodexAuthError(params: { |
| 344 | message?: string | null |