Skip to content

Commit

Permalink
Parse Stripe error correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewangeta committed Jun 19, 2019
1 parent 2802fdf commit 51e0b54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/StripeKit/Errors/StripeError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import Foundation
/// Stripe uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the `2xx` range indicate success. Codes in the `4xx` range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the `5xx` range indicate an error with Stripe's servers (these are rare).
/// Some `4xx` errors that could be handled programmatically (e.g., a card is declined) include an error code that briefly explains the error reported.
public final class StripeError: StripeModel, Error {
public var error: _StripeError?
}

public final class _StripeError: StripeModel {
/// The type of error returned. One of `api_connection_error`, `api_error`, `authentication_error`, `card_error`, `idempotency_error`, `invalid_request_error`, or `rate_limit_error`
public var type: StripeErrorType?
/// For card errors, the ID of the failed charge.
Expand Down

0 comments on commit 51e0b54

Please sign in to comment.