-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptions.php
More file actions
142 lines (128 loc) · 2.56 KB
/
Exceptions.php
File metadata and controls
142 lines (128 loc) · 2.56 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
/*! \addtogroup Exceptions
* @{
*/
/**
* Redirect exception.
*/
class RedirectException extends Exception
{
public function __construct($url, $code = 302, $get = array())
{
if (count($get) > 0) {
$url .= '?' . http_build_query($get);
}
parent::__construct($url, $code);
}
}
/**
* Return http code 304 (Not Modified).
*/
class Exception304 extends Exception
{
public function __construct($message = 'Not Modified')
{
parent::__construct($message, 304);
}
}
/**
* Return http code 400 (Bad Request).
*/
class Exception400 extends Exception
{
public function __construct($message = 'Bad Request')
{
parent::__construct($message, 400);
}
}
/**
* Return http code 401 (Unauthorized).
*/
class Exception401 extends Exception
{
public function __construct($message = 'Unauthorized')
{
parent::__construct($message, 401);
}
}
/**
* Return http code 403 (Forbidden).
*/
class Exception403 extends Exception
{
public function __construct($message = 'Forbidden')
{
parent::__construct($message, 403);
}
}
/**
* Return http code 404 (Not Found).
*/
class Exception404 extends Exception
{
public function __construct($message = 'Not Found')
{
parent::__construct($message, 404);
}
}
/**
* Return http code 405 (Method Not Allowed).
*/
class Exception405 extends Exception
{
public function __construct($message = 'Method Not Allowed')
{
parent::__construct($message, 405);
}
}
/**
* Return http code 409 (Conflict).
*/
class Exception409 extends Exception
{
public function __construct($message = 'Conflict')
{
parent::__construct($message, 409);
}
}
/**
* Return http code 410 (Gone).
*/
class Exception410 extends Exception
{
public function __construct($message = 'Gone')
{
parent::__construct($message, 410);
}
}
/**
* Return http code 418 (I'm a teapot).
*/
class Exception418 extends Exception
{
public function __construct($message = "I'm a teapot")
{
parent::__construct($message, 418);
}
}
/**
* Return http code 500 (Internal Server Error).
*/
class Exception500 extends Exception
{
public function __construct($message = 'Internal Server Error')
{
parent::__construct($message, 500);
}
}
/**
* Return http code 501 (Not Implemented).
*/
class Exception501 extends Exception
{
public function __construct($message = 'Not Implemented')
{
parent::__construct($message, 501);
}
}
/*! @} endgroup Exceptions */