PHP5: Exceptions must valid objects that are derived from class Exception?
| From: | Erik Franzén | Date: | Sun, 22 Feb 2004 14:36:49 +0000 |
| Subject: | PHP5: Exceptions must valid objects that are derived from class Exception? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-8046@lists.php.net to get a copy of this message | ||
I am prototyping on a PHP5 application using PEAR and I ran into a strange error.
if (PEAR::isError($mReturn)) {
throw $mReturn;
}
PEAR is not configured to return exceptions instead of PEAR Errors and the above code will generate the following error if $mReturn is a PEAR Error.
PHP Fatal error: Exceptions must valid objects that are derived from class Exception in E:\PHPSource\PHPFTP\Source\include\\db.inc.php on line 226
Why must I use the built in exception class? The explantion in release notes for PHPb4 is that it allows a general catch(Exception $e) statement to catch all exceptions.
Isn't that up to the developer to deal with it?
/Erik