OPError

@objc
public class OPError : NSError

Error class for all OloPay-pecific errors

Errors will come back as either Error or NSError instances. To get an instance of this class just check that it is the correct type and cast to OPError.

func someMethod(error: Error?) {
    if let opError = error as? OPError {
        //Do something with the error
    }
}
  • Domain for all OPError instances

    Declaration

    Swift

    @objc
    public static let oloPayDomain: String
  • Error type key for the userInfo property. This can be used to access the error type, but the errorType property exposes this information directly

    Declaration

    Swift

    @objc
    public static let errorTypeKey: String
  • Card error type key for the userInfo property. This can be used to access the card error type, but the cardErrorType property exposes this information directly

    Important

    This key only exists in the userInfo dictionary if the error represents a card error

    Declaration

    Swift

    @objc
    public static let cardErrorTypeKey: String
  • The type of error

    Declaration

    Swift

    public var errorType: OPErrorType { get }
  • If errorType is cardError, this holds the type of error. For any other error type this is nil

    Declaration

    Swift

    public var cardErrorType: OPCardErrorType? { get }
  • If errorType is cardError, this holds a user-friendly message that can be displayed to the user. For any other error type this is nil

    Note

    This is a convenience property that is functionally equivalent to using localizedDescription

    Declaration

    Swift

    public var cardErrorMessage: String? { get }