1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: */
11:
12: // no namespace
13:
14:
15:
16: /*
17: some useful SPL exception:
18:
19: - LogicException
20: - InvalidArgumentException
21: - LengthException
22: - RuntimeException
23: - OutOfBoundsException
24: - UnexpectedValueException
25:
26: other SPL exceptions are ambiguous; do not use them
27:
28: ErrorException is corrupted in PHP < 5.3
29: */
30:
31:
32:
33: /**
34: * The exception that is thrown when the value of an argument is
35: * outside the allowable range of values as defined by the invoked method.
36: */
37: class ArgumentOutOfRangeException extends InvalidArgumentException
38: {
39: }
40:
41:
42:
43: /**
44: * The exception that is thrown when a method call is invalid for the object's
45: * current state, method has been invoked at an illegal or inappropriate time.
46: */
47: class InvalidStateException extends RuntimeException
48: {
49: public function __construct($message = '', $code = 0, Exception $previous = NULL)
50: {
51: if (PHP_VERSION_ID < 50300) {
52: $this->previous = $previous;
53: parent::__construct($message, $code);
54: } else {
55: parent::__construct($message, $code, $previous);
56: }
57: }
58: }
59:
60:
61:
62: /**
63: * The exception that is thrown when a requested method or operation is not implemented.
64: */
65: class NotImplementedException extends LogicException
66: {
67: }
68:
69:
70:
71: /**
72: * The exception that is thrown when an invoked method is not supported. For scenarios where
73: * it is sometimes possible to perform the requested operation, see InvalidStateException.
74: */
75: class NotSupportedException extends LogicException
76: {
77: }
78:
79:
80:
81: /**
82: * The exception that is thrown when a requested method or operation is deprecated.
83: */
84: class DeprecatedException extends NotSupportedException
85: {
86: }
87:
88:
89:
90: /**
91: * The exception that is thrown when accessing a class member (property or method) fails.
92: */
93: class MemberAccessException extends LogicException
94: {
95: }
96:
97:
98:
99: /**
100: * The exception that is thrown when an I/O error occurs.
101: */
102: class IOException extends RuntimeException
103: {
104: }
105:
106:
107:
108: /**
109: * The exception that is thrown when accessing a file that does not exist on disk.
110: */
111: class FileNotFoundException extends IOException
112: {
113: }
114:
115:
116:
117: /**
118: * The exception that is thrown when part of a file or directory cannot be found.
119: */
120: class DirectoryNotFoundException extends IOException
121: {
122: }
123:
124:
125:
126: /**
127: * The exception that indicates errors that can not be recovered from. Execution of
128: * the script should be halted.
129: */
130: class FatalErrorException extends Exception
131: {
132: private $severity;
133:
134: public function __construct($message, $code, $severity, $file, $line, $context)
135: {
136: parent::__construct($message, $code);
137: $this->severity = $severity;
138: $this->file = $file;
139: $this->line = $line;
140: $this->context = $context;
141: }
142:
143: public function getSeverity()
144: {
145: return $this->severity;
146: }
147:
148: }
149: