| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
class WC_Vipps_Recurring_Exception extends Exception { |
| 6 |
|
| 7 |
/** sanitized/localized error message */ |
| 8 |
protected string $localized_message; |
| 9 |
|
| 10 |
public $response_code; |
| 11 |
public $is_idempotent_error = false; |
| 12 |
|
| 13 |
/** |
| 14 |
* Setup exception |
| 15 |
* |
| 16 |
* @param string $error_message Full response |
| 17 |
* @param string $localized_message user-friendly translated error message |
| 18 |
* |
| 19 |
* @since 4.0.2 |
| 20 |
*/ |
| 21 |
public function __construct( $error_message = '', $localized_message = '' ) { |
| 22 |
$this->localized_message = $localized_message; |
| 23 |
parent::__construct( $error_message ); |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Returns the localized message. |
| 28 |
* |
| 29 |
* @return string |
| 30 |
* @since 4.0.2 |
| 31 |
*/ |
| 32 |
public function getLocalizedMessage(): string { |
| 33 |
return $this->localized_message; |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
// Temporary errors like 500-class errors |
| 38 |
class WC_Vipps_Recurring_Temporary_Exception extends WC_Vipps_Recurring_Exception { |
| 39 |
// |
| 40 |
} |
| 41 |
|
| 42 |
// Misconfigurations |
| 43 |
class WC_Vipps_Recurring_Config_Exception extends WC_Vipps_Recurring_Exception { |
| 44 |
// |
| 45 |
} |
| 46 |
|
| 47 |
// Missing required value |
| 48 |
class WC_Vipps_Recurring_Missing_Value_Exception extends WC_Vipps_Recurring_Exception { |
| 49 |
// |
| 50 |
} |
| 51 |
|
| 52 |
// Invalid value value |
| 53 |
class WC_Vipps_Recurring_Invalid_Value_Exception extends WC_Vipps_Recurring_Exception { |
| 54 |
// |
| 55 |
} |
| 56 |
|