note 95403 added to language.exceptions.extending
| From: | iamhiddensomewhere at gmail dot com | Date: | Thu, 31 Dec 2009 23:17:53 +0000 |
| Subject: | note 95403 added to language.exceptions.extending | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164507@lists.php.net to get a copy of this message | ||
As previously noted exception linking was recently added (and what a god-send it is, it certainly
makes layer abstraction (and, by association, exception tracking) easier).
Since <5.3 was lacking this useful feature I took some initiative and creating a custom exception
class that all of my exceptions inherit from:
<?php
class SystemException extends Exception
{
private $previous;
public function __construct($message, $code = 0, Exception $previous = null)
{
parent::__construct($message, $code);
if (!is_null($previous))
{
$this -> previous = $previous;
}
}
public function getPrevious()
{
return $this -> previous;
}
}
?>
Hope you find it useful.
----
Server IP: 66.207.199.35
Probable Submitter: 99.241.57.135
----
Manual Page -- http://www.php.net/manual/en/language.exceptions.extending.php
Edit -- https://master.php.net/note/edit/95403
Del: integrated -- https://master.php.net/note/delete/95403/integrated
Del: useless -- https://master.php.net/note/delete/95403/useless
Del: bad code -- https://master.php.net/note/delete/95403/bad+code
Del: spam -- https://master.php.net/note/delete/95403/spam
Del: non-english -- https://master.php.net/note/delete/95403/non-english
Del: in docs -- https://master.php.net/note/delete/95403/in+docs
Del: other reasons-- https://master.php.net/note/delete/95403
Reject -- https://master.php.net/note/reject/95403
Search -- https://master.php.net/manage/user-notes.php