Ausnahmen
In der MF-Welt sollte es im Idealfall keine klassischen PHP-Fehler geben. Alle Fehler werden in Exceptions verwandelt, welche besser vom Programmierer gehandhabt werden können.
Das Framework benötigt die SPL Erweiterung, welche allerdings standardmäßig aktiviert sein sollte. Dies erlaubt die Verwendung der folgenden Ausnahmeklassen:
Exception | core | Exception-Basisklasse |
ErrorException | core | Fehler, die zu Ausnahmen umgewandelt wurden |
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 | Ausnahme für ungültige Parameterwerte |
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 | Ausnahme für nicht erwartete Werte |
Mammut vervollständigt dies um einige weitere Ausnahmen:
Klasse | Namespace | Info | Basis |
---|---|---|---|
ExtensionException | Mammut\Exception | Ausnahme für fehlende PHP-Erweiterungen | Exception |
IllegalStateException | Mammut\Exception | Für nicht zulässige Stati des Systems | RuntimeException |
ImplementationException | Mammut\Exception | Ausnahme für (noch) nicht implementierte Bereiche | Exception |
IOException | Mammut\IO | Allgemeine I/O-Fehler | RuntimeException |
FileNotFoundException | Mammut\IO | Ausnahme für fehlende Dateien | IOException |
Weitere Ausnahmen können kontextspezifisch existieren.