PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / includes / core / exception / class-wpfnl-api-exception.php

class-wpfnl-api-exception.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.1, at includes/core/exception/class-wpfnl-api-exception.php

67 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Exceptions API
4 *
5 * @package
6 */
7 namespace WPFunnels\Exception;
8
9 use Exception;
10
11 class Wpfnl_Api_Exception extends Exception
12 {
13
14 /**
15 * Sanitized error code.
16 *
17 * @var string
18 */
19 protected $error_code;
20
21
22 /**
23 * Error extra data.
24 *
25 * @var array
26 */
27 protected $error_data;
28
29
30 /**
31 * Setup exception.
32 *
33 * @param string $code Machine-readable error code, e.g `woocommerce_invalid_product_id`.
34 * @param string $message User-friendly translated error message, e.g. 'Product ID is invalid'.
35 * @param int $http_status_code Proper HTTP status code to respond with, e.g. 400.
36 * @param array $data Extra error data.
37 */
38 public function __construct($code, $message, $http_status_code = 400, $data = [])
39 {
40 $this->error_code = $code;
41 $this->error_data = array_merge([ 'status' => $http_status_code ], $data);
42 parent::__construct($message, $http_status_code);
43 }
44
45
46 /**
47 * Returns the error code.
48 *
49 * @return string
50 */
51 public function getErrorCode()
52 {
53 return $this->error_code;
54 }
55
56
57 /**
58 * Returns error data.
59 *
60 * @return array
61 */
62 public function getErrorData()
63 {
64 return $this->error_data;
65 }
66 }
67