The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type { StripeOpError } from "@distilled.cloud/stripe"; |
| 2 | |
| 3 | /** |
| 4 | * Stripe retrieve/delete often returns `InvalidRequestError` with |
| 5 | * `code: "resource_missing"` instead of a typed NotFound. HTTP 5xx errors |
| 6 | * carry a numeric `code`, so this predicate must accept the full |
| 7 | * {@link StripeOpError} union (not `{ code?: string }`). |
| 8 | */ |
| 9 | export const isMissingStripeResource = (error: StripeOpError): boolean => { |
| 10 | if (error._tag === "NotFound") { |
| 11 | return true; |
| 12 | } |
| 13 | return error._tag === "InvalidRequestError" && error.code === "resource_missing"; |
| 14 | }; |