summaryrefslogtreecommitdiff
path: root/poc/poc02-compiling-cake/src/vendor/cakephp-2.2.1-0-gcc44130/lib/Cake/Error/exceptions.php
blob: 94952f12e4f5ab42aa6b1dd82fbb59a1f2eb9435 (plain)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
<?php
/**
 * Exceptions file.  Contains the various exceptions CakePHP will throw until they are
 * moved into their permanent location.
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://book.cakephp.org/2.0/en/development/testing.html
 * @package       Cake.Error
 * @since         CakePHP(tm) v 2.0
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

/**
 * Parent class for all of the HTTP related exceptions in CakePHP.
 * All HTTP status/error related exceptions should extend this class so
 * catch blocks can be specifically typed.
 *
 * @package       Cake.Error
 */
if (!class_exists('HttpException')) {
	class HttpException extends RuntimeException {
	}
}

/**
 * Represents an HTTP 400 error.
 *
 * @package       Cake.Error
 */
class BadRequestException extends HttpException {

/**
 * Constructor
 *
 * @param string $message If no message is given 'Bad Request' will be the message
 * @param string $code Status code, defaults to 400
 */
	public function __construct($message = null, $code = 400) {
		if (empty($message)) {
			$message = 'Bad Request';
		}
		parent::__construct($message, $code);
	}

}

/**
 * Represents an HTTP 401 error.
 *
 * @package       Cake.Error
 */
class UnauthorizedException extends HttpException {

/**
 * Constructor
 *
 * @param string $message If no message is given 'Unauthorized' will be the message
 * @param string $code Status code, defaults to 401
 */
	public function __construct($message = null, $code = 401) {
		if (empty($message)) {
			$message = 'Unauthorized';
		}
		parent::__construct($message, $code);
	}

}

/**
 * Represents an HTTP 403 error.
 *
 * @package       Cake.Error
 */
class ForbiddenException extends HttpException {

/**
 * Constructor
 *
 * @param string $message If no message is given 'Forbidden' will be the message
 * @param string $code Status code, defaults to 403
 */
	public function __construct($message = null, $code = 403) {
		if (empty($message)) {
			$message = 'Forbidden';
		}
		parent::__construct($message, $code);
	}

}

/**
 * Represents an HTTP 404 error.
 *
 * @package       Cake.Error
 */
class NotFoundException extends HttpException {

/**
 * Constructor
 *
 * @param string $message If no message is given 'Not Found' will be the message
 * @param string $code Status code, defaults to 404
 */
	public function __construct($message = null, $code = 404) {
		if (empty($message)) {
			$message = 'Not Found';
		}
		parent::__construct($message, $code);
	}

}

/**
 * Represents an HTTP 405 error.
 *
 * @package       Cake.Error
 */
class MethodNotAllowedException extends HttpException {

/**
 * Constructor
 *
 * @param string $message If no message is given 'Method Not Allowed' will be the message
 * @param string $code Status code, defaults to 405
 */
	public function __construct($message = null, $code = 405) {
		if (empty($message)) {
			$message = 'Method Not Allowed';
		}
		parent::__construct($message, $code);
	}

}

/**
 * Represents an HTTP 500 error.
 *
 * @package       Cake.Error
 */
class InternalErrorException extends HttpException {

/**
 * Constructor
 *
 * @param string $message If no message is given 'Internal Server Error' will be the message
 * @param string $code Status code, defaults to 500
 */
	public function __construct($message = null, $code = 500) {
		if (empty($message)) {
			$message = 'Internal Server Error';
		}
		parent::__construct($message, $code);
	}

}

/**
 * CakeException is used a base class for CakePHP's internal exceptions.
 * In general framework errors are interpreted as 500 code errors.
 *
 * @package       Cake.Error
 */
class CakeException extends RuntimeException {

/**
 * Array of attributes that are passed in from the constructor, and
 * made available in the view when a development error is displayed.
 *
 * @var array
 */
	protected $_attributes = array();

/**
 * Template string that has attributes sprintf()'ed into it.
 *
 * @var string
 */
	protected $_messageTemplate = '';

/**
 * Constructor.
 *
 * Allows you to create exceptions that are treated as framework errors and disabled
 * when debug = 0.
 *
 * @param string|array $message Either the string of the error message, or an array of attributes
 *   that are made available in the view, and sprintf()'d into CakeException::$_messageTemplate
 * @param string $code The code of the error, is also the HTTP status code for the error.
 */
	public function __construct($message, $code = 500) {
		if (is_array($message)) {
			$this->_attributes = $message;
			$message = __d('cake_dev', $this->_messageTemplate, $message);
		}
		parent::__construct($message, $code);
	}

/**
 * Get the passed in attributes
 *
 * @return array
 */
	public function getAttributes() {
		return $this->_attributes;
	}

}

/**
 * Missing Controller exception - used when a controller
 * cannot be found.
 *
 * @package       Cake.Error
 */
class MissingControllerException extends CakeException {

	protected $_messageTemplate = 'Controller class %s could not be found.';

	public function __construct($message, $code = 404) {
		parent::__construct($message, $code);
	}

}

/**
 * Missing Action exception - used when a controller action
 * cannot be found.
 *
 * @package       Cake.Error
 */
class MissingActionException extends CakeException {

	protected $_messageTemplate = 'Action %s::%s() could not be found.';

	public function __construct($message, $code = 404) {
		parent::__construct($message, $code);
	}

}

/**
 * Private Action exception - used when a controller action
 * starts with a  `_`.
 *
 * @package       Cake.Error
 */
class PrivateActionException extends CakeException {

	protected $_messageTemplate = 'Private Action %s::%s() is not directly accessible.';

	public function __construct($message, $code = 404, Exception $previous = null) {
		parent::__construct($message, $code, $previous);
	}

}

/**
 * Used when a component cannot be found.
 *
 * @package       Cake.Error
 */
class MissingComponentException extends CakeException {

	protected $_messageTemplate = 'Component class %s could not be found.';

}

/**
 * Used when a behavior cannot be found.
 *
 * @package       Cake.Error
 */
class MissingBehaviorException extends CakeException {

	protected $_messageTemplate = 'Behavior class %s could not be found.';

}

/**
 * Used when a view file cannot be found.
 *
 * @package       Cake.Error
 */
class MissingViewException extends CakeException {

	protected $_messageTemplate = 'View file "%s" is missing.';

}

/**
 * Used when a layout file cannot be found.
 *
 * @package       Cake.Error
 */
class MissingLayoutException extends CakeException {

	protected $_messageTemplate = 'Layout file "%s" is missing.';

}

/**
 * Used when a helper cannot be found.
 *
 * @package       Cake.Error
 */
class MissingHelperException extends CakeException {

	protected $_messageTemplate = 'Helper class %s could not be found.';

}

/**
 * Runtime Exceptions for ConnectionManager
 *
 * @package       Cake.Error
 */
class MissingDatabaseException extends CakeException {

	protected $_messageTemplate = 'Database connection "%s" could not be found.';

}

/**
 * Used when no connections can be found.
 *
 * @package       Cake.Error
 */
class MissingConnectionException extends CakeException {

	protected $_messageTemplate = 'Database connection "%s" is missing, or could not be created.';

	public function __construct($message, $code = 500) {
		if (is_array($message)) {
			$message += array('enabled' => true);
		}
		parent::__construct($message, $code);
	}

}

/**
 * Used when a Task cannot be found.
 *
 * @package       Cake.Error
 */
class MissingTaskException extends CakeException {

	protected $_messageTemplate = 'Task class %s could not be found.';

}

/**
 * Used when a shell method cannot be found.
 *
 * @package       Cake.Error
 */
class MissingShellMethodException extends CakeException {

	protected $_messageTemplate = "Unknown command %1\$s %2\$s.\nFor usage try `cake %1\$s --help`";

}

/**
 * Used when a shell cannot be found.
 *
 * @package       Cake.Error
 */
class MissingShellException extends CakeException {

	protected $_messageTemplate = 'Shell class %s could not be found.';

}

/**
 * Exception class to be thrown when a datasource configuration is not found
 *
 * @package       Cake.Error
 */
class MissingDatasourceConfigException extends CakeException {

	protected $_messageTemplate = 'The datasource configuration "%s" was not found in database.php';

}

/**
 * Used when a datasource cannot be found.
 *
 * @package       Cake.Error
 */
class MissingDatasourceException extends CakeException {

	protected $_messageTemplate = 'Datasource class %s could not be found.';

}

/**
 * Exception class to be thrown when a database table is not found in the datasource
 *
 * @package       Cake.Error
 */
class MissingTableException extends CakeException {

	protected $_messageTemplate = 'Table %s for model %s was not found in datasource %s.';

}

/**
 * Exception raised when a Model could not be found.
 *
 * @package       Cake.Error
 */
class MissingModelException extends CakeException {

	protected $_messageTemplate = 'Model %s could not be found.';

}

/**
 * Exception raised when a test loader could not be found
 *
 * @package       Cake.Error
 */
class MissingTestLoaderException extends CakeException {

	protected $_messageTemplate = 'Test loader %s could not be found.';

}

/**
 * Exception raised when a plugin could not be found
 *
 * @package       Cake.Error
 */
class MissingPluginException extends CakeException {

	protected $_messageTemplate = 'Plugin %s could not be found.';

}

/**
 * Exception raised when a Dispatcher filter could not be found
 *
 * @package       Cake.Error
 */
class MissingDispatcherFilterException extends CakeException {

	protected $_messageTemplate = 'Dispatcher filter %s could not be found.';

}

/**
 * Exception class for AclComponent and Interface implementations.
 *
 * @package       Cake.Error
 */
class AclException extends CakeException {
}

/**
 * Exception class for Cache.  This exception will be thrown from Cache when it
 * encounters an error.
 *
 * @package       Cake.Error
 */
class CacheException extends CakeException {
}

/**
 * Exception class for Router.  This exception will be thrown from Router when it
 * encounters an error.
 *
 * @package       Cake.Error
 */
class RouterException extends CakeException {
}

/**
 * Exception class for CakeLog.  This exception will be thrown from CakeLog when it
 * encounters an error.
 *
 * @package       Cake.Error
 */
class CakeLogException extends CakeException {
}

/**
 * Exception class for CakeSession.  This exception will be thrown from CakeSession when it
 * encounters an error.
 *
 * @package       Cake.Error
 */
class CakeSessionException extends CakeException {
}

/**
 * Exception class for Configure.  This exception will be thrown from Configure when it
 * encounters an error.
 *
 * @package       Cake.Error
 */
class ConfigureException extends CakeException {
}

/**
 * Exception class for Socket. This exception will be thrown from CakeSocket, CakeEmail, HttpSocket
 * SmtpTransport, MailTransport and HttpResponse when it encounters an error.
 *
 * @package       Cake.Error
 */
class SocketException extends CakeException {
}

/**
 * Exception class for Xml.  This exception will be thrown from Xml when it
 * encounters an error.
 *
 * @package       Cake.Error
 */
class XmlException extends CakeException {
}

/**
 * Exception class for Console libraries.  This exception will be thrown from Console library
 * classes when they encounter an error.
 *
 * @package       Cake.Error
 */
class ConsoleException extends CakeException {
}

/**
 * Represents a fatal error
 *
 * @package       Cake.Error
 */
class FatalErrorException extends CakeException {

/**
 * Constructor
 *
 * @param string $message
 * @param integer $code
 * @param string $file
 * @param integer $line
 */
	public function __construct($message, $code = 500, $file = null, $line = null) {
		parent::__construct($message, $code);
		if ($file) {
			$this->file = $file;
		}
		if ($line) {
			$this->line = $line;
		}
	}

}

/**
 * Not Implemented Exception - used when an API method is not implemented
 *
 * @package       Cake.Error
 */
class NotImplementedException extends CakeException {

	protected $_messageTemplate = '%s is not implemented.';

	public function __construct($message, $code = 501) {
		parent::__construct($message, $code);
	}

}