UNPKG

@adyen/react-native

Version:

Wraps Adyen Checkout Drop-In and Components for iOS and Android for convenient use with React Native

39 lines (28 loc) 868 B
interface CheckoutErrorOptions { cause: any; } class AdyenCheckoutError extends Error { protected static errorTypes = { /** Network error. */ NETWORK_ERROR: 'NETWORK_ERROR', /** Shopper canceled the current transaction. */ CANCEL: 'CANCEL', /** Implementation error. The method or parameter are incorrect or are not supported. */ IMPLEMENTATION_ERROR: 'IMPLEMENTATION_ERROR', /** Generic error. */ ERROR: 'ERROR', /** Error while requesting new session from sessionData */ SESSION_ERROR: 'SESSION_ERROR', }; public cause: unknown; constructor( type: keyof typeof AdyenCheckoutError.errorTypes, message?: string, options?: CheckoutErrorOptions ) { super(message); this.name = AdyenCheckoutError.errorTypes[type]; this.cause = options?.cause; } } export default AdyenCheckoutError;