The best way to control Claude Code, Codex and more from any computer or phone

main
ts 14 lines 556 Bytes
Raw
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 };