abstracts
1 year ago
admin
1 year ago
blocks
1 year ago
cli
1 year ago
customizer
1 year ago
data-stores
1 year ago
emails
1 year ago
export
1 year ago
gateways
1 year ago
import
1 year ago
integrations
1 year ago
interfaces
1 year ago
legacy
1 year ago
libraries
1 year ago
log-handlers
1 year ago
payment-tokens
1 year ago
queue
1 year ago
react-admin
1 year ago
rest-api
1 year ago
shipping
1 year ago
shortcodes
1 year ago
theme-support
1 year ago
tracks
1 year ago
traits
1 year ago
walkers
1 year ago
wccom-site
1 year ago
widgets
1 year ago
class-wc-ajax.php
1 year ago
class-wc-api.php
1 year ago
class-wc-auth.php
1 year ago
class-wc-autoloader.php
1 year ago
class-wc-background-emailer.php
1 year ago
class-wc-background-updater.php
1 year ago
class-wc-breadcrumb.php
1 year ago
class-wc-cache-helper.php
1 year ago
class-wc-cart-fees.php
1 year ago
class-wc-cart-session.php
1 year ago
class-wc-cart-totals.php
1 year ago
class-wc-cart.php
1 year ago
class-wc-checkout.php
1 year ago
class-wc-cli.php
1 year ago
class-wc-comments.php
1 year ago
class-wc-countries.php
1 year ago
class-wc-coupon.php
1 year ago
class-wc-customer-download-log.php
1 year ago
class-wc-customer-download.php
1 year ago
class-wc-customer.php
1 year ago
class-wc-data-exception.php
1 year ago
class-wc-data-store.php
1 year ago
class-wc-datetime.php
1 year ago
class-wc-deprecated-action-hooks.php
1 year ago
class-wc-deprecated-filter-hooks.php
1 year ago
class-wc-discounts.php
1 year ago
class-wc-download-handler.php
1 year ago
class-wc-emails.php
1 year ago
class-wc-embed.php
1 year ago
class-wc-form-handler.php
1 year ago
class-wc-frontend-scripts.php
1 year ago
class-wc-geo-ip.php
1 year ago
class-wc-geolite-integration.php
1 year ago
class-wc-geolocation.php
1 year ago
class-wc-https.php
1 year ago
class-wc-install.php
1 year ago
class-wc-integrations.php
1 year ago
class-wc-log-levels.php
1 year ago
class-wc-logger.php
1 year ago
class-wc-meta-data.php
1 year ago
class-wc-order-factory.php
1 year ago
class-wc-order-item-coupon.php
1 year ago
class-wc-order-item-fee.php
1 year ago
class-wc-order-item-meta.php
1 year ago
class-wc-order-item-product.php
1 year ago
class-wc-order-item-shipping.php
1 year ago
class-wc-order-item-tax.php
1 year ago
class-wc-order-item.php
1 year ago
class-wc-order-query.php
1 year ago
class-wc-order-refund.php
1 year ago
class-wc-order.php
1 year ago
class-wc-payment-gateways.php
1 year ago
class-wc-payment-tokens.php
1 year ago
class-wc-post-data.php
1 year ago
class-wc-post-types.php
1 year ago
class-wc-privacy-background-process.php
1 year ago
class-wc-privacy-erasers.php
1 year ago
class-wc-privacy-exporters.php
1 year ago
class-wc-privacy.php
1 year ago
class-wc-product-attribute.php
1 year ago
class-wc-product-download.php
1 year ago
class-wc-product-external.php
1 year ago
class-wc-product-factory.php
1 year ago
class-wc-product-grouped.php
1 year ago
class-wc-product-query.php
1 year ago
class-wc-product-simple.php
1 year ago
class-wc-product-variable.php
1 year ago
class-wc-product-variation.php
1 year ago
class-wc-query.php
1 year ago
class-wc-rate-limiter.php
1 year ago
class-wc-regenerate-images-request.php
1 year ago
class-wc-regenerate-images.php
1 year ago
class-wc-register-wp-admin-settings.php
1 year ago
class-wc-rest-authentication.php
1 year ago
class-wc-rest-exception.php
1 year ago
class-wc-session-handler.php
1 year ago
class-wc-shipping-rate.php
1 year ago
class-wc-shipping-zone.php
1 year ago
class-wc-shipping-zones.php
1 year ago
class-wc-shipping.php
1 year ago
class-wc-shortcodes.php
1 year ago
class-wc-structured-data.php
1 year ago
class-wc-tax.php
1 year ago
class-wc-template-loader.php
1 year ago
class-wc-tracker.php
1 year ago
class-wc-validation.php
1 year ago
class-wc-webhook.php
1 year ago
class-woocommerce.php
1 year ago
wc-account-functions.php
1 year ago
wc-attribute-functions.php
1 year ago
wc-cart-functions.php
1 year ago
wc-conditional-functions.php
1 year ago
wc-core-functions.php
1 year ago
wc-coupon-functions.php
1 year ago
wc-deprecated-functions.php
1 year ago
wc-formatting-functions.php
1 year ago
wc-notice-functions.php
1 year ago
wc-order-functions.php
1 year ago
wc-order-item-functions.php
1 year ago
wc-page-functions.php
1 year ago
wc-product-functions.php
1 year ago
wc-rest-functions.php
1 year ago
wc-stock-functions.php
1 year ago
wc-template-functions.php
1 year ago
wc-template-hooks.php
1 year ago
wc-term-functions.php
1 year ago
wc-update-functions.php
1 year ago
wc-user-functions.php
1 year ago
wc-webhook-functions.php
1 year ago
wc-widget-functions.php
1 year ago
class-wc-data-exception.php
65 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Data Exception Class |
| 4 | * |
| 5 | * Extends Exception to provide additional data. |
| 6 | * |
| 7 | * @package WooCommerce\Classes |
| 8 | * @since 3.0.0 |
| 9 | */ |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | /** |
| 14 | * Data exception class. |
| 15 | */ |
| 16 | class WC_Data_Exception extends Exception { |
| 17 | |
| 18 | /** |
| 19 | * Sanitized error code. |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | protected $error_code; |
| 24 | |
| 25 | /** |
| 26 | * Error extra data. |
| 27 | * |
| 28 | * @var array |
| 29 | */ |
| 30 | protected $error_data; |
| 31 | |
| 32 | /** |
| 33 | * Setup exception. |
| 34 | * |
| 35 | * @param string $code Machine-readable error code, e.g `woocommerce_invalid_product_id`. |
| 36 | * @param string $message User-friendly translated error message, e.g. 'Product ID is invalid'. |
| 37 | * @param int $http_status_code Proper HTTP status code to respond with, e.g. 400. |
| 38 | * @param array $data Extra error data. |
| 39 | */ |
| 40 | public function __construct( $code, $message, $http_status_code = 400, $data = array() ) { |
| 41 | $this->error_code = $code; |
| 42 | $this->error_data = array_merge( array( 'status' => $http_status_code ), $data ); |
| 43 | |
| 44 | parent::__construct( $message, $http_status_code ); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Returns the error code. |
| 49 | * |
| 50 | * @return string |
| 51 | */ |
| 52 | public function getErrorCode() { |
| 53 | return $this->error_code; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Returns error data. |
| 58 | * |
| 59 | * @return array |
| 60 | */ |
| 61 | public function getErrorData() { |
| 62 | return $this->error_data; |
| 63 | } |
| 64 | } |
| 65 |