| 1 | <?php |
||
| 20 | class WC_Data_Exception extends Exception { |
||
| 21 | |||
| 22 | /** @var string sanitized error code */ |
||
| 23 | protected $error_code; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Setup exception. |
||
| 27 | * |
||
| 28 | * error code - machine-readable, e.g. `woocommerce_invalid_product_id` |
||
| 29 | * error message - friendly message, e.g. 'Product ID is invalid' |
||
| 30 | * http status code - proper HTTP status code to respond with, e.g. 400 |
||
| 31 | * |
||
| 32 | * @param string $error_code |
||
| 33 | * @param string $error_message user-friendly translated error message |
||
| 34 | * @param int $http_status_code HTTP status code to respond with |
||
| 35 | */ |
||
| 36 | public function __construct( $error_code, $error_message, $http_status_code = 400 ) { |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Returns the error code |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | public function getErrorCode() { |
||
| 48 | } |
||
| 49 |