PluginProbe
Remote Website Management by Watchful / trunk
Remote Website Management by Watchful vtrunk
v2.0.17 v2.0.16 v2.0.15 v2.0.14 v2.0.13 v2.0.12 v2.0.11 trunk v1.2.11 v1.2.12 v1.2.13 v1.2.14 v1.2.17 v1.2.19 v1.2.20 v1.2.9 v1.3.0 v1.3.1 v1.3.2 v1.4.1 v1.4.10 v1.4.11 v1.4.12 v1.4.2 v1.4.3 All 72 releases
watchful / lib / Exception.php

Exception.php in Remote Website Management by Watchful trunk, at lib/Exception.php

58 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Watchful exception definitions.
4 *
5 * @version 2016-12-20 11:41 UTC+01
6 * @package watchful
7 * @author Watchful
8 * @authorUrl https://watchful.net
9 * @copyright Copyright (c) 2020 watchful.net
10 * @license GNU/GPL
11 */
12
13 namespace Watchful;
14
15 use Throwable;
16
17 /**
18 * Class for Watchful excepction definitions.
19 */
20 class Exception extends \Exception
21 {
22 /**
23 * Exception data.
24 *
25 * @var mixed
26 */
27 private $data = null;
28
29 /**
30 * Constructor for our custom Exceptions. It is compatible with the
31 * standard php exceptions as well.
32 *
33 * @param string $message Either a full message or a short key similar to \WP_Error codes.
34 * @param int $code The inherited \Exception code, used as status code for the HTTP response.
35 * @param mixed $data Either some data related to the message or a \Throwable for the standard php \Exception.
36 */
37 public function __construct($message = '', $code = 0, $data = null)
38 {
39 // Handle php standard format for Exceptions with $previous as 3rd parameter.
40 if ($data instanceof \Exception || $data instanceof Throwable) {
41 parent::__construct($message, $code, $data);
42 }
43
44 $this->data = $data;
45 parent::__construct($message, $code, null);
46 }
47
48 /**
49 * Get the exception data.
50 *
51 * @return mixed
52 */
53 public function getData()
54 {
55 return $this->data;
56 }
57 }
58