In the world of the MF, errors should not happen. All errors are mapped to Exceptions, which can be better handled by the programmer.
The framework requires the SPL extension, which should be enabled by default. This allows the usage of the folloing exeption classes by default.
Exception | core | Exception base class |
ErrorException | core | Used for errors which are converted to errors |
BadFunctionCallException | spl | Exception thrown if a callback refers to an undefined function or if some arguments are missing |
BadMethodCallException | spl | Exception thrown if a callback refers to an undefined method or if some arguments are missing |
DomainException | spl | A domain exception |
InvalidArgumentException | spl | Exception thrown if a argument does not match with the expected value |
LengthException | spl | Exception thrown if a length is invalid |
LogicException | spl | Exception thrown if a logic expression is invalid |
OutOfBoundsException | spl | Exception thrown if a value is not a valid key |
OutOfRangeException | spl | Exception thrown when a value does not match with a range |
OverflowException | spl | Exception thrown when you add an element into a full container |
RangeException | spl | Exception thrown when an invalid range is given |
RuntimeException | spl | Exception thrown if an error which can only be found on runtime occurs |
UnderflowException | spl | Exception thrown when you try to remove an element of an empty container |
UnexpectedValueException | spl | Exception thrown if a value does not match with a set of values |
Mammut provides some additional base exeptions:
Class | Namespace | Info | Autoload | Parent |
---|---|---|---|---|
MFExtensionException | Mammut.Exception | Exception thrown when a required extension is missing | y | Exception |
MFIllegalStateException | Mammut.Exception | n | RuntimeException | |
MFImplementationException | Mammut.Exception | Exception thrown when a implementation is missing | n | Exception |
MFIOException | Mammut.IO | Generic I/O exception | y | RuntimeException |
MFFileNotFoundException | Mammut.IO | Exception thrown when a file or directory is not found | y | MFIOException |
Some areas add special exceptions based on their needs.