>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 ;-)
http://php.net/set_error_handler http://php.net/trigger_error http://php.net/error_log Pretty much, take those and a little discipline with your programming staff, and you're done... Maybe write some kind of error message system that creates a unique ID for each error message. You can wrap it up in some Objects if that makes you happy. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php