swissChili | f0cbdc3 | 2023-01-05 17:21:38 -0500 | [diff] [blame] | 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Stripe Exception Class |
| 4 | * |
| 5 | * Extends Exception to provide additional data |
| 6 | * |
| 7 | * @since 4.0.2 |
| 8 | */ |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; |
| 12 | } |
| 13 | |
| 14 | class WC_Stripe_Exception extends Exception { |
| 15 | |
| 16 | /** |
| 17 | * String sanitized/localized error message. |
| 18 | * |
| 19 | * @var string */ |
| 20 | protected $localized_message; |
| 21 | |
| 22 | /** |
| 23 | * Setup exception |
| 24 | * |
| 25 | * @since 4.0.2 |
| 26 | * @param string $error_message Full response |
| 27 | * @param string $localized_message user-friendly translated error message |
| 28 | */ |
| 29 | public function __construct( $error_message = '', $localized_message = '' ) { |
| 30 | $this->localized_message = $localized_message; |
| 31 | parent::__construct( $error_message ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Returns the localized message. |
| 36 | * |
| 37 | * @since 4.0.2 |
| 38 | * @return string |
| 39 | */ |
| 40 | public function getLocalizedMessage() { |
| 41 | return $this->localized_message; |
| 42 | } |
| 43 | } |