UNPKG

@exodus/react-native-payments

Version:

[![react-native version](https://img.shields.io/badge/react--native-0.41-0ba7d3.svg?style=flat-square)](http://facebook.github.io/react-native/releases/0.40) [![npm](https://img.shields.io/npm/v/react-native-payments.svg?style=flat-square)](https://www.np

30 lines (29 loc) 1.13 kB
import ExtendableError from 'es6-error'; const ERROR_MESSAGES = { AbortError: 'The operation was aborted.', InvalidStateError: 'The object is in an invalid state.', NotAllowedError: 'The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.', NotSupportedError: 'The operation is not supported.', SecurityError: 'The operation is insecure.' }; class ReactNativePaymentsError extends ExtendableError { constructor(errorMessage) { super(`[ReactNativePayments] ${errorMessage}`); } } export class DOMException extends ReactNativePaymentsError { constructor(errorType) { const errorMessage = ERROR_MESSAGES[errorType] || errorType; super(`DOMException: ${errorMessage}`); } } export class TypeError extends ReactNativePaymentsError { constructor(errorMessage) { super(`TypeError: ${errorMessage}`); } } export class ConstructorError extends ReactNativePaymentsError { constructor(errorMessage) { super(`Failed to construct 'PaymentRequest': ${errorMessage}`); } }