PEAR_ErrorStack
Table of Contents
- Introduction to using PEAR_ErrorStack for advanced error handling — Using PEAR_ErrorStack to do both simple and advanced error handling
- constructor PEAR_ErrorStack::PEAR_ErrorStack — Set up a new error stack instance
- PEAR_ErrorStack::getErrorMessage — Standard error message generation callback
- PEAR_ErrorStack::getErrorMessageTemplate — Standard Error Message Template generator from error code
- PEAR_ErrorStack::getErrors — Retrieve all errors since last purge
- PEAR_ErrorStack::getFileLine — Standard file/line number/function/class context callback
- PEAR_ErrorStack::getMessageCallback — Get an error code => error message mapping callback
- PEAR_ErrorStack::hasErrors — Determine whether there are any errors on the stack
- PEAR_ErrorStack::pop — Pop an error off of the error stack
- PEAR_ErrorStack::popCallback — Remove a callback from the error callback stack
- PEAR_ErrorStack::push — Add an error to the stack
- PEAR_ErrorStack::pushCallback — Set an error Callback If set to a valid callback, this will be called every time an error is pushed onto the stack. The return value will be used to determine whether to allow an error to be pushed or logged.
- PEAR_ErrorStack::raiseError — emulate PEAR::raiseError
- PEAR_ErrorStack::setContextCallback — Set a callback that generates context information (location of error) for an error stack
- PEAR_ErrorStack::setDefaultCallback — Sets a default callback to be used by all error stacks
- PEAR_ErrorStack::setDefaultLogger — Set up a PEAR::Log object for all error stacks that don't have one
- PEAR_ErrorStack::setErrorMessageTemplate — Set the Error Message Template array
- PEAR_ErrorStack::setLogger — Set up a PEAR::Log object for this error stack
- PEAR_ErrorStack::setMessageCallback — Set an error code => error message mapping callback
- PEAR_ErrorStack::singleton — Return a single error stack for this package.
- PEAR_ErrorStack::staticGetErrors — Get a list of all errors since last purge, organized by package
- PEAR_ErrorStack::staticHasErrors — Determine whether there are any errors on any error stack
- PEAR_ErrorStack::staticPop — Static version of pop
- PEAR_ErrorStack::staticPopCallback — Remove a callback from every error callback stack
- PEAR_ErrorStack::staticPush — Static version of push
- PEAR_ErrorStack::staticPushCallback — Set an error Callback for every package's error stack
- PEAR_ErrorStack::_log — Log an error using PEAR::Log
- Package PEAR_ErrorStack Constants — Constants defined in and used by PEAR_ErrorStack
PEAR_ErrorStack is an experimental error raising and handling implementation for PEAR that is designed to replace PEAR_Error when it has stabilized. PEAR_ErrorStack is both backwards compatible with PEAR_Error and forward compatible with PHP 5's PEAR_Exception class. There are many other features, all described in the Introduction.
Usage:
1 // global error stack
2 $global_stack = &PEAR_ErrorStack::
singleton('MyPackage');
3 // local error stack
4 $local_stack = new
PEAR_ErrorStack('MyPackage');