1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Nette\Application;
9:
10: use Nette\Http;
11:
12:
13: /**
14: * The exception that is thrown when user attempts to terminate the current presenter or application.
15: * This is special "silent exception" with no error message or code.
16: */
17: class AbortException extends \Exception
18: {
19: }
20:
21:
22: /**
23: * Application fatal error.
24: */
25: class ApplicationException extends \Exception
26: {
27: }
28:
29:
30: /**
31: * The exception that is thrown when a presenter cannot be loaded.
32: */
33: class InvalidPresenterException extends \Exception
34: {
35: }
36:
37:
38: /**
39: * The exception that indicates client error with HTTP code 4xx.
40: */
41: class BadRequestException extends \Exception
42: {
43: /** @var int */
44: protected $code = Http\IResponse::S404_NOT_FOUND;
45:
46:
47: public function __construct($message = '', $httpCode = 0, \Exception $previous = null)
48: {
49: parent::__construct($message, $httpCode ?: $this->code, $previous);
50: }
51:
52:
53: /**
54: * @return int
55: */
56: public function getHttpCode()
57: {
58: return $this->code;
59: }
60: }
61:
62:
63: /**
64: * Forbidden request exception - access denied.
65: */
66: class ForbiddenRequestException extends BadRequestException
67: {
68: /** @var int */
69: protected $code = Http\IResponse::S403_FORBIDDEN;
70: }
71: