Translations:Manual:Coding conventions/PHP/308/en

When your code encounters a sudden error, you should throw an exception rather than using PHP's $trigger. The exception handler will display this as nicely as possible to the end user and wiki administrator, and also provides a stack trace to developers. Don't throw an instance of Exception itself, but instead a subclass of it. Exceptions that indicate programming errors should be one of the [$spl exceptions that ship with PHP] or a more specific subclass, while exceptions that indicate errors that are relevant to the end user should be an [$errorpagerror ErrorPageError] or one of its subclasses.