-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathXDException.php
More file actions
56 lines (50 loc) · 1.62 KB
/
Copy pathXDException.php
File metadata and controls
56 lines (50 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* Base exception class for all custom XDMoD exceptions.
*/
abstract class XDException extends \Exception
{
/**
* The message used by this exception if none is provided.
*/
const defaultMessage = 'Unknown XDMoD Exception Occurred';
/**
* The code used by this exception if none is provided.
*/
const defaultCode = XDError::UnknownXdmodException;
/**
* An array of data related to the exception that occurred to be used
* by clients. This can be structured as needed on a per-exception basis,
* but it should always contain data that can be broken down into
* whatever output format the client requests (JSON, etc.).
*
* @var array
*/
public $errorData = array();
/**
* An HTTP status code to use when this exception is thrown.
*
* To be a code that's usable by the global exception handler, there must
* be a corresponding header message that can be found by the handler.
* If one cannot be found, it will fall back to a generic 500 code.
*
* @var integer
*/
public $httpCode = 500;
/**
* A set of headers to be used when this exception is thrown.
*
* Specifying the HTTP status code should be done through httpCode and not
* here.
*
* Headers should be stored as key-value pairs in this array corresponding
* to the header key and header value.
*
* @var array
*/
public $headers = array();
public function __construct($message = self::defaultMessage, $code = self::defaultCode, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}