StripeError

stripe-node · payments, error-handling, stripe-errors, error-class, decline-codes

Custom error class wrapping raw Stripe API errors, providing structured access to error details like codes, decline reasons, and related objects for programmatic handling.

// Source: https://github.com/stripe/stripe-node | License: MIT | Copyright 2011 Ask Bjørn Hansen
// Provided via justclaw.it.com; keep this notice with the code.
export class StripeError extends Error {
  readonly message: string;
  readonly userMessage?: string;
  readonly type: string;
  readonly raw: unknown;
  readonly rawType?: RawErrorType;
  readonly headers?: {[header: string]: string};
  readonly requestId?: string;
  readonly detail?: string | Error | HttpClientResponseError;
  readonly statusCode?: number;

  // errorProperties: The beginning of the section generated from our OpenAPI spec
  /**
   * For card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://docs.stripe.com/declines#retrying-issuer-declines) if they pro

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key