Base PEAR_Exception Class
WARNING: This code should be considered stable, but the API is subject to immediate and drastic change, so API stability is at best alpha
1) Features:
protected $message protected $code protected $line protected $file private $trace
4) Inherited methods from PHP Exception Class:
__clone __construct getMessage getCode getFile getLine getTraceSafe getTraceSafeAsString __toString
5) Usage example
- require_once 'PEAR/Exception.php';
- class Test {
- function foo() {
- throw new PEAR_Exception('Error Message', ERROR_CODE);
- }
- }
- function myLogger($pear_exception) {
- echo $pear_exception->getMessage();
- }
- // each time a exception is thrown the 'myLogger' will be called
- // (its use is completely optional)
- PEAR_Exception::addObserver('myLogger');
- $test = new Test;
- try {
- $test->foo();
- } catch (PEAR_Exception $e) {
- print $e;
- }
Located in /maintenance/libraries/pear/PEAR/Exception.php (line 99)
Exception | --PEAR_Exception
Supported signatures:
PEAR_Exception(string $message); PEAR_Exception(string $message, int $code); PEAR_Exception(string $message, Exception $cause); PEAR_Exception(string $message, Exception $cause, int $code); PEAR_Exception(string $message, array $causes); PEAR_Exception(string $message, array $causes, int $code);
Returns the exception that caused this exception to be thrown
Function must be public to call on caused exceptions
Return specific error information that can be used for more detailed error messages or translation.
This method may be overridden in child exception classes in order to add functionality not present in PEAR_Exception and is a placeholder to define API
The returned array must be an associative array of parameter => value like so:
array('name' => $name, 'context' => array(...))
Documentation generated on Fri, 3 Dec 2004 12:26:37 +0000 by phpDocumentor 1.3.0RC3