Re: How can i convert one object to another. Convert Exception object to MyException Object.
| From: | Zoltán Németh | Date: | Wed, 28 Mar 2007 08:42:33 +0000 |
| Subject: | Re: How can i convert one object to another. Convert Exception object to MyException Object. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251518@lists.php.net to get a copy of this message | ||
2007. 03. 28, szerda keltezéssel 08.55-kor Mathijs ezt írta:
> Hello there,
>
> I am trying to convert one object to another, something like clone.
>
> For example.
> ---
> class MyException extends Exception {
> // My functions etc.. etc..
> }
>
> function ExceptionHandler($exception) {
> // Convert an NoN MyException to an MyException????
> }
>
> set_exception_handler('ExceptionHandler');
> ---
>
> Then when i do a:
> throw new Exception('My Message', 1);
why not use
throw new MyException('My Message', 1);
and then you don't have to convert it
greets
Zoltán Németh
>
> And i don't catch it my self, it will get into the ExceptionHandler.
> Now i have some special methods within MyException to handle stuff.
> And i want to copy/convert the $exception (Exception) object to a
> MyException object to use its methods.
>
> Thx in advanced.
>