PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 5.3
MainWP Dashboard: Self-hosted WordPress Management for Agencies v5.3
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
mainwp / class / class-mainwp-extra-exception.php

class-mainwp-extra-exception.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 5.3, at class/class-mainwp-extra-exception.php

65 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 * MainWP Extra Exception
4 *
5 * @package MainWP/Dashboard
6 * @since 5.2
7 */
8
9 namespace MainWP\Dashboard;
10
11 defined( 'ABSPATH' ) || exit;
12
13 /**
14 * Extra exception class.
15 */
16 class MainWP_Extra_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 `mainwp_invalid_site_id`.
36 * @param string $message User-friendly translated error message, e.g. 'Site ID is invalid'.
37 * @param string $http_status_code HTTP status code.
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 = $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