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;
- }
Class | Description |
---|---|
![]() |
Base PEAR_Exception Class |
Documentation generated on Fri, 11 Feb 2005 18:13:06 +0000 by phpDocumentor 1.3.0RC3