| 1 |
<?php |
| 2 |
|
| 3 |
namespace StoreEngine\Classes; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
die(); |
| 7 |
} |
| 8 |
|
| 9 |
use Exception; |
| 10 |
use WP_Error; |
| 11 |
|
| 12 |
/** |
| 13 |
* WP_Error compatible exception. |
| 14 |
* |
| 15 |
* @deprecated moved to StoreEngine\Classes\Exceptions\StoreEngineException; |
| 16 |
*/ |
| 17 |
class StoreEngineException extends Exception { |
| 18 |
|
| 19 |
protected $wp_code; |
| 20 |
|
| 21 |
protected $data = ''; |
| 22 |
|
| 23 |
public function __construct( $message, $wp_code, $data = null, $code = 0, ?Exception $previous = null ) { |
| 24 |
parent::__construct( $message, $code, $previous ); |
| 25 |
|
| 26 |
$this->wp_code = $wp_code; |
| 27 |
if ( $data ) { |
| 28 |
$this->data = $data; |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
public function get_wp_code() { |
| 33 |
return $this->wp_code; |
| 34 |
} |
| 35 |
|
| 36 |
public function get_data() { |
| 37 |
return $this->data; |
| 38 |
} |
| 39 |
|
| 40 |
public function get_wp_error() { |
| 41 |
return new WP_Error( $this->wp_code, $this->getMessage(), $this->data ); |
| 42 |
} |
| 43 |
} |
| 44 |
|