Commit | Line | Data |
---|---|---|
659673d5 MS |
1 | --- |
2 | title: Exceptions | |
3 | sidebar: sidebar | |
4 | permalink: php_exceptions.html | |
5 | folder: php | |
6 | --- | |
7 | ||
8 | ## SPL Exceptions | |
9 | ||
10 | 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. | |
11 | ||
12 | ||
13 | ## Custom Exceptions | |
14 | ||
15 | {% include callout.html content="Do not use `wcf\system\exception\SystemException` anymore, use specific exception classes!" type="warning" %} | |
16 | ||
17 | The following table contains a list of custom exceptions that are commonly used. | |
18 | ||
19 | | exception | (examples) when to use | | |
20 | |-----------|------------------------| | |
08b653a6 | 21 | | `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) | |
659673d5 MS |
22 | | `wcf\system\exception\ImplementationException` | a class does not implement an expected interface | |
23 | | `wcf\system\exception\InvalidObjectTypeException` | object type is not of an expected object type definition | | |
24 | | `wcf\system\exception\InvalidSecurityTokenException` | given security token does not match the security token of the active user's session | | |
25 | | `wcf\system\exception\ParentClassException` | a class does not extend an expected (parent) class | | |
08b653a6 | 26 | | `wcf\system\exception\PermissionDeniedException` | page access without permission, action execution without permission (is shown as http 403 error to the user) | |
659673d5 | 27 | | `wcf\system\exception\UserInputException` | user input does not pass validation | |