Re: exceptions instead of errors

From: Date: Tue, 13 May 2003 01:46:16 +0000
Subject: Re: exceptions instead of errors
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-1463@lists.php.net to get a copy of this message
On Monday, May 12, 2003, at 08:08 PM, Steven Brown wrote:
And if BC is everything and you want your old libs then simply noone forces you to use PHP5.
Why should we have to rewrite all our libraries for php5 just to use them? That seems rather heavy-handed. What's needed is a way to recognize code written before PHP threw exceptions on internals so PHP can just simply do the right thing. The '%' prefix on internals idea was one way of doing that. I'd much rather a solution along those lines exist than have to rewrite all my code.
Why would you have to rewrite all your code? If you don't catch the error, it will be fatal (just as before). If you are in a try block when you call the library generating an error, you have the option of a) rethrowing the error b) not catching the exception type thrown (I'm for a new default type SystemException extends Exception for this btw) c) handling the exception a and b give you the behavior you had in php4, c allows you to possibly recover. At any rate, since try{} catch{} did not exist when you wrote your library, you wouldn't have to rewrite any old code, just be aware of the new semantics when you write new code that uses your old libraries. George

« previous php.internals (#1463) next »