Merge pull request #114 from WoltLab/mkdocs
[GitHub/WoltLab/woltlab.github.io.git] / docs / php / exceptions.md
1 # Exceptions
2
3 ## SPL Exceptions
4
5 The [Standard PHP Library (SPL)](https://secure.php.net/manual/en/book.spl.php) provides some [exceptions](https://secure.php.net/manual/en/spl.exceptions.php) that should be used whenever possible.
6
7
8 ## Custom Exceptions
9
10 !!! warning "Do not use `wcf\system\exception\SystemException` anymore, use specific exception classes!"
11
12 The following table contains a list of custom exceptions that are commonly used.
13
14 | exception | (examples) when to use |
15 |-----------|------------------------|
16 | `wcf\system\exception\IllegalLinkException` | access to a page that belongs to a non-existing object, executing actions on specific non-existing objects (is shown as http 404 error to the user) |
17 | `wcf\system\exception\ImplementationException` | a class does not implement an expected interface |
18 | `wcf\system\exception\InvalidObjectTypeException` | object type is not of an expected object type definition |
19 | `wcf\system\exception\InvalidSecurityTokenException` | given security token does not match the security token of the active user's session |
20 | `wcf\system\exception\ParentClassException` | a class does not extend an expected (parent) class |
21 | `wcf\system\exception\PermissionDeniedException` | page access without permission, action execution without permission (is shown as http 403 error to the user) |
22 | `wcf\system\exception\UserInputException` | user input does not pass validation |