Liking cljdoc? Tell your friends :D

stream.clojure.stripe.error

Structured error handling using Cognitect anomalies pattern.

Anomaly categories map to Stripe/HTTP errors:

  • :cognitect.anomalies/busy - 429 Rate limit
  • :cognitect.anomalies/unavailable - 5xx Server errors, connection errors
  • :cognitect.anomalies/interrupted - Request timeout
  • :cognitect.anomalies/incorrect - 400 Invalid request, card errors
  • :cognitect.anomalies/forbidden - 401/403 Auth errors
  • :cognitect.anomalies/not-found - 404 Resource not found
  • :cognitect.anomalies/conflict - 409 Idempotency errors
  • :cognitect.anomalies/fault - Unexpected errors, parse failures
Structured error handling using Cognitect anomalies pattern.

Anomaly categories map to Stripe/HTTP errors:
- :cognitect.anomalies/busy        - 429 Rate limit
- :cognitect.anomalies/unavailable - 5xx Server errors, connection errors
- :cognitect.anomalies/interrupted - Request timeout
- :cognitect.anomalies/incorrect   - 400 Invalid request, card errors
- :cognitect.anomalies/forbidden   - 401/403 Auth errors
- :cognitect.anomalies/not-found   - 404 Resource not found
- :cognitect.anomalies/conflict    - 409 Idempotency errors
- :cognitect.anomalies/fault       - Unexpected errors, parse failures
raw docstring

anomaly?clj

(anomaly? response)

Returns true if response contains an anomaly category.

Returns true if response contains an anomaly category.
sourceraw docstring

build-anomalyclj

(build-anomaly status body request-id)

Builds an anomaly map from HTTP status, response body, and request-id.

Builds an anomaly map from HTTP status, response body, and request-id.
sourceraw docstring

categoryclj

(category response)

Returns the anomaly category keyword, or nil if not an anomaly.

Returns the anomaly category keyword, or nil if not an anomaly.
sourceraw docstring

decline-codeclj

(decline-code response)

Returns the card decline code (e.g. "insufficient_funds"), or nil.

Returns the card decline code (e.g. "insufficient_funds"), or nil.
sourceraw docstring

exception->anomalyclj

(exception->anomaly e)

Converts a Java exception to an anomaly map.

Converts a Java exception to an anomaly map.
sourceraw docstring

http-status->categoryclj

Maps HTTP status codes to anomaly categories.

Maps HTTP status codes to anomaly categories.
sourceraw docstring

messageclj

(message response)

Returns the error message.

Returns the error message.
sourceraw docstring

parse-stripe-errorclj

(parse-stripe-error body)

Parses a Stripe error response body into namespaced keys. Returns nil if no :error key in body.

Parses a Stripe error response body into namespaced keys.
Returns nil if no :error key in body.
sourceraw docstring

retryable?clj

(retryable? response)

Returns true if the anomaly is potentially retryable. Categories :busy, :unavailable, and :interrupted may succeed on retry.

Returns true if the anomaly is potentially retryable.
Categories :busy, :unavailable, and :interrupted may succeed on retry.
sourceraw docstring

status->categoryclj

(status->category status)

Returns anomaly category for HTTP status, with fallback based on range.

Returns anomaly category for HTTP status, with fallback based on range.
sourceraw docstring

stripe-error-codeclj

(stripe-error-code response)

Returns the Stripe error code string (e.g. "card_declined"), or nil.

Returns the Stripe error code string (e.g. "card_declined"), or nil.
sourceraw docstring

stripe-error-typeclj

(stripe-error-type response)

Returns the Stripe error type string (e.g. "card_error"), or nil.

Returns the Stripe error type string (e.g. "card_error"), or nil.
sourceraw docstring

stripe-type->categoryclj

Maps Stripe error types to anomaly categories. Takes precedence over HTTP status when available.

Maps Stripe error types to anomaly categories.
Takes precedence over HTTP status when available.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close