note 93430 deleted from language.exceptions by danbrown
| From: | danbrown@php.net | Date: | Wed, 09 Sep 2009 20:33:08 +0000 |
| Subject: | note 93430 deleted from language.exceptions by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160369@lists.php.net to get a copy of this message | ||
Note Submitter: venrox at gmail dot com
----
@rctay89 at gmail dot com
You were verry close, but to make it work with multiple extending __CLASS__ will show parent name
therefore:
<?php
class MyException extends Exception {
public function __toString() {
return "exception '".get_class($this)."' with message
'".$this->getMessage()."' in
".$this->getFile().":".$this->getLine()."\nStack
trace:\n".$this->getTraceAsString();
}
}
?>