errors.ts
Language TypeScript913 B30 lines
/** Raised when the environment is not configured for live requests. */export class ConfigError extends Error {constructor(message: string) {super(message);this.name = "ConfigError";}}/*** Wraps one of the API's several documented error shapes:* {"error": "Invalid request"} | {"notice": "No match"} | ...* `raw` preserves the body so callers can disambiguate (e.g. treat* orders.splitShipments "No match" as "not multi-address").*/export class PlinthApiError extends Error {readonly raw: unknown;constructor(message: string, raw: unknown) {super(message);this.name = "PlinthApiError";this.raw = raw;}}/** The API's fixed rate limit was hit: 10 requests / 10 seconds. */export class RateLimitError extends PlinthApiError {constructor(raw: unknown) {super("Too many requests. Slow down and retry.", raw);this.name = "RateLimitError";}}