Re: PHP5: Exceptions must valid objects that are derived from class Exception?
| From: | Derick Rethans | Date: | Sun, 22 Feb 2004 17:03:28 +0000 |
| Subject: | Re: PHP5: Exceptions must valid objects that are derived from class Exception? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8051@lists.php.net to get a copy of this message | ||
On Sun, 22 Feb 2004, [ISO-8859-1] Erik Franzén wrote:
> With this behavior you force the developer to use the exception class.
> You cannot use your own class because PHP will trigger an error if you do.
>
> However, you can of course extend the exception class with your own
> class, but you cannot replace the default methods (getMessage etc) since
> they are final.
>
> I don't like this, since you are forced to use the built in exception
> class which also has final methods. Where has the feeling of freedom gone?
Freedom goes with functionality ;-) but I think it's indeed not wise to
have getMessage defined as final. (I don't think it makes sense for the
other methods to be overridden though).
Derick