Emulating Java Exceptions
| From: | Garland Foster | Date: | Fri, 12 Jul 2002 13:49:40 +0000 |
| Subject: | Emulating Java Exceptions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-107363@lists.php.net to get a copy of this message | ||
Hi All,
I'm porting Java Code to PHP, my question is: What is the best approach to emulate Java exceptions in PHP4? (I know ZE2 adds exceptions but I can't wait).
When a Java method "throws" an exception it is difficult to handle as a "return" of an exception object since then I'd have to check in every sinlge line that calls a method if the returned value is an exception and then return and exception etc etc. (Chaning that up to the user would be a nightmare).
So I need some clever ideas ;-)
Thanks,
Garland.