| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\Api\Exceptions; |
| 4 |
|
| 5 |
class WPErrorException extends \Exception |
| 6 |
{ |
| 7 |
public function __construct(WP_Error $wpError, $message = "", $code = 0 , Exception $previous = NULL) |
| 8 |
{ |
| 9 |
$this->wpError = $wpError; |
| 10 |
|
| 11 |
$this->code = $code ?: $wpError->get_error_code(); |
| 12 |
|
| 13 |
$this->message = $message ?: $wpError->get_error_message(); |
| 14 |
|
| 15 |
parent::__construct($message, $code, $previous); |
| 16 |
} |
| 17 |
|
| 18 |
public function errors() |
| 19 |
{ |
| 20 |
return $this->wpError->get_error_messages(); |
| 21 |
} |
| 22 |
} |
| 23 |
|