Configuring Error Dispatch
- public static function initialize() — Registers this class as the PHP error and exception handler. This will overwrite any previous handlers!
- public static function setErrorListener($listener) — Provide an optional listener callback which will receive all errors, exceptions and debugging messages. It can then print them to a web console, for example.
Exception Utilities
- public static function getPreviousException($ex) — Gets the previous exception of a nested exception. Prior to PHP 5.3 you can use @{class:PhutilProxyException} to nest exceptions; after PHP 5.3 all exceptions are nestable.
- public static function getRootException($ex) — Find the most deeply nested exception from a possibly-nested exception.
Error Traps
- public static function addErrorTrap($trap) — Adds an error trap. Normally you should not invoke this directly; @{class:PhutilErrorTrap} registers itself on construction.
- public static function removeErrorTrap($trap) — Removes an error trap. Normally you should not invoke this directly; @{class:PhutilErrorTrap} deregisters itself on destruction.
Internals
- public static function hasInitialized() — Determine if PhutilErrorHandler has been initialized.
- public static function handleError($num, $str, $file, $line, $ctx) — Handles PHP errors and dispatches them forward. This is a callback for ##set_error_handler()##. You should not call this function directly; use @{function:phlog} to print debugging messages or ##trigger_error()## to trigger PHP errors.
- public static function handleException($ex) — Handles PHP exceptions and dispatches them forward. This is a callback for ##set_exception_handler()##. You should not call this function directly; to print exceptions, pass the exception object to @{function:phlog}.
- public static function outputStacktrace($trace) — Output a stacktrace to the PHP error log.
- public static function formatStacktrace($trace) — Format a stacktrace for output.
- public static function dispatchErrorMessage($event, $value, $metadata) — All different types of error messages come here before they are dispatched to the listener; this method also prints them to the PHP error log.
Other Methods
- public function __get($name)
- public function __set($name, $value)
- public function current()
- public function key()
- public function next()
- public function rewind()
- public function valid()
- private function throwOnAttemptedIteration()
- public function getPhobjectClassConstant($key, $byte_limit) — Read the value of a class constant.
- public static function adjustFilePath($path)
- public static function getLibraryVersions()
- public static function getExceptionTrace($ex) — Get a full trace across all proxied and aggregated exceptions.