svn: /pear2/Exception/trunk/ RELEASE-0.2.0

From: Date: Mon, 22 Feb 2010 00:46:03 +0000
Subject: svn: /pear2/Exception/trunk/ RELEASE-0.2.0
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9195@lists.php.net to get a copy of this message
dufuz Mon, 22 Feb 2010 00:46:03 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295353 Log: update changelog Changed paths: U pear2/Exception/trunk/RELEASE-0.2.0 Modified: pear2/Exception/trunk/RELEASE-0.2.0 =================================================================== --- pear2/Exception/trunk/RELEASE-0.2.0 2010-02-22 00:44:50 UTC (rev 295352) +++ pear2/Exception/trunk/RELEASE-0.2.0 2010-02-22 00:46:03 UTC (rev 295353) @@ -7,4 +7,36 @@ This can be achieved by writing a custom callback function, using the appropriate printf(), trigger_error and die() to achieve the same result. - Removed getErroClass and getErrorMethod as it can be easily gotten from getTrace/getTraceSafe first array element -- Add the proper LICENSE file and move Exception.php to the NEW BSD license as the package.xml already defines \ No newline at end of file +- Add the proper LICENSE file and move Exception.php to the NEW BSD license as the package.xml already defines +- Removed __toString, toText and toHtml. For those wanting to get pretty outputs they can use this approach: + + $causes = array(); + $this->getCauseMessage($causes); + foreach ($causes as $i => $cause) { + var_dump($cause); + } + + And combine that with getTraceSafe() or getTraceAsString() if needed. + + Put all that in a function and use set_exception_handler('exceptionHandler'); or similar to process + all Exceptions. + + Example code or see the removed code at http://svn.php.net/viewvc/pear2/Exception/trunk/src/Exception.php?r1=295348&r2=295352 : + + function exceptionHandler($e) + { + if ($e instanceof \pear2\Exception) { + $causes = array(); + $e->getCauseMessage($causes); + $causeMsg = ''; + foreach ($causes as $i => $cause) { + $causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': ' + . $cause['message'] . "\n"; + } + echo $causeMsg; + } else { + echo $e->getMessage(), "\n"; + } + } + + set_exception_handler('exceptionHandler'); \ No newline at end of file

« previous php.pear.core (#9195) next »