1: <?php
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: if (!class_exists('HttpException')) {
29: class HttpException extends RuntimeException {
30: }
31: }
32:
33: 34: 35: 36: 37:
38: class BadRequestException extends HttpException {
39:
40: 41: 42: 43: 44: 45:
46: public function __construct($message = null, $code = 400) {
47: if (empty($message)) {
48: $message = 'Bad Request';
49: }
50: parent::__construct($message, $code);
51: }
52:
53: }
54:
55: 56: 57: 58: 59:
60: class UnauthorizedException extends HttpException {
61:
62: 63: 64: 65: 66: 67:
68: public function __construct($message = null, $code = 401) {
69: if (empty($message)) {
70: $message = 'Unauthorized';
71: }
72: parent::__construct($message, $code);
73: }
74:
75: }
76:
77: 78: 79: 80: 81:
82: class ForbiddenException extends HttpException {
83:
84: 85: 86: 87: 88: 89:
90: public function __construct($message = null, $code = 403) {
91: if (empty($message)) {
92: $message = 'Forbidden';
93: }
94: parent::__construct($message, $code);
95: }
96:
97: }
98:
99: 100: 101: 102: 103:
104: class NotFoundException extends HttpException {
105:
106: 107: 108: 109: 110: 111:
112: public function __construct($message = null, $code = 404) {
113: if (empty($message)) {
114: $message = 'Not Found';
115: }
116: parent::__construct($message, $code);
117: }
118:
119: }
120:
121: 122: 123: 124: 125:
126: class MethodNotAllowedException extends HttpException {
127:
128: 129: 130: 131: 132: 133:
134: public function __construct($message = null, $code = 405) {
135: if (empty($message)) {
136: $message = 'Method Not Allowed';
137: }
138: parent::__construct($message, $code);
139: }
140:
141: }
142:
143: 144: 145: 146: 147:
148: class InternalErrorException extends HttpException {
149:
150: 151: 152: 153: 154: 155:
156: public function __construct($message = null, $code = 500) {
157: if (empty($message)) {
158: $message = 'Internal Server Error';
159: }
160: parent::__construct($message, $code);
161: }
162:
163: }
164:
165: 166: 167: 168: 169: 170:
171: class CakeException extends RuntimeException {
172:
173: 174: 175: 176: 177: 178:
179: protected $_attributes = array();
180:
181: 182: 183: 184: 185:
186: protected $_messageTemplate = '';
187:
188: 189: 190: 191: 192: 193: 194: 195: 196: 197:
198: public function __construct($message, $code = 500) {
199: if (is_array($message)) {
200: $this->_attributes = $message;
201: $message = __d('cake_dev', $this->_messageTemplate, $message);
202: }
203: parent::__construct($message, $code);
204: }
205:
206: 207: 208: 209: 210:
211: public function getAttributes() {
212: return $this->_attributes;
213: }
214:
215: }
216:
217: 218: 219: 220: 221: 222:
223: class MissingControllerException extends CakeException {
224:
225: protected $_messageTemplate = 'Controller class %s could not be found.';
226:
227: public function __construct($message, $code = 404) {
228: parent::__construct($message, $code);
229: }
230:
231: }
232:
233: 234: 235: 236: 237: 238:
239: class MissingActionException extends CakeException {
240:
241: protected $_messageTemplate = 'Action %s::%s() could not be found.';
242:
243: public function __construct($message, $code = 404) {
244: parent::__construct($message, $code);
245: }
246:
247: }
248:
249: 250: 251: 252: 253: 254:
255: class PrivateActionException extends CakeException {
256:
257: protected $_messageTemplate = 'Private Action %s::%s() is not directly accessible.';
258:
259: public function __construct($message, $code = 404, Exception $previous = null) {
260: parent::__construct($message, $code, $previous);
261: }
262:
263: }
264:
265: 266: 267: 268: 269:
270: class MissingComponentException extends CakeException {
271:
272: protected $_messageTemplate = 'Component class %s could not be found.';
273:
274: }
275:
276: 277: 278: 279: 280:
281: class MissingBehaviorException extends CakeException {
282:
283: protected $_messageTemplate = 'Behavior class %s could not be found.';
284:
285: }
286:
287: 288: 289: 290: 291:
292: class MissingViewException extends CakeException {
293:
294: protected $_messageTemplate = 'View file "%s" is missing.';
295:
296: }
297:
298: 299: 300: 301: 302:
303: class MissingLayoutException extends CakeException {
304:
305: protected $_messageTemplate = 'Layout file "%s" is missing.';
306:
307: }
308:
309: 310: 311: 312: 313:
314: class MissingHelperException extends CakeException {
315:
316: protected $_messageTemplate = 'Helper class %s could not be found.';
317:
318: }
319:
320: 321: 322: 323: 324:
325: class MissingDatabaseException extends CakeException {
326:
327: protected $_messageTemplate = 'Database connection "%s" could not be found.';
328:
329: }
330:
331: 332: 333: 334: 335:
336: class MissingConnectionException extends CakeException {
337:
338: protected $_messageTemplate = 'Database connection "%s" is missing, or could not be created.';
339:
340: public function __construct($message, $code = 500) {
341: if (is_array($message)) {
342: $message += array('enabled' => true);
343: }
344: parent::__construct($message, $code);
345: }
346: }
347:
348: 349: 350: 351: 352:
353: class MissingTaskException extends CakeException {
354:
355: protected $_messageTemplate = 'Task class %s could not be found.';
356:
357: }
358:
359: 360: 361: 362: 363:
364: class MissingShellMethodException extends CakeException {
365:
366: protected $_messageTemplate = "Unknown command %1\$s %2\$s.\nFor usage try `cake %1\$s --help`";
367:
368: }
369:
370: 371: 372: 373: 374:
375: class MissingShellException extends CakeException {
376:
377: protected $_messageTemplate = 'Shell class %s could not be found.';
378:
379: }
380:
381: 382: 383: 384: 385:
386: class MissingDatasourceConfigException extends CakeException {
387:
388: protected $_messageTemplate = 'The datasource configuration "%s" was not found in database.php';
389:
390: }
391:
392: 393: 394: 395: 396:
397: class MissingDatasourceException extends CakeException {
398:
399: protected $_messageTemplate = 'Datasource class %s could not be found.';
400:
401: }
402:
403: 404: 405: 406: 407:
408: class MissingTableException extends CakeException {
409:
410: protected $_messageTemplate = 'Table %s for model %s was not found in datasource %s.';
411:
412: }
413:
414: 415: 416: 417: 418:
419: class MissingModelException extends CakeException {
420:
421: protected $_messageTemplate = 'Model %s could not be found.';
422:
423: }
424:
425: 426: 427: 428: 429:
430: class MissingTestLoaderException extends CakeException {
431:
432: protected $_messageTemplate = 'Test loader %s could not be found.';
433:
434: }
435:
436: 437: 438: 439: 440:
441: class MissingPluginException extends CakeException {
442:
443: protected $_messageTemplate = 'Plugin %s could not be found.';
444:
445: }
446:
447: 448: 449: 450: 451:
452: class AclException extends CakeException {
453: }
454:
455: 456: 457: 458: 459: 460:
461: class CacheException extends CakeException {
462: }
463:
464: 465: 466: 467: 468: 469:
470: class RouterException extends CakeException {
471: }
472:
473: 474: 475: 476: 477: 478:
479: class CakeLogException extends CakeException {
480: }
481:
482: 483: 484: 485: 486: 487:
488: class CakeSessionException extends CakeException {
489: }
490:
491: 492: 493: 494: 495: 496:
497: class ConfigureException extends CakeException {
498: }
499:
500: 501: 502: 503: 504: 505:
506: class SocketException extends CakeException {
507: }
508:
509: 510: 511: 512: 513: 514:
515: class XmlException extends CakeException {
516: }
517:
518: 519: 520: 521: 522: 523:
524: class ConsoleException extends CakeException {
525: }
526: