RE: [PHP-DEV] exceptions instead of errors

From: Date: Mon, 12 May 2003 23:52:01 +0000
Subject: RE: [PHP-DEV] exceptions instead of errors
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-1455@lists.php.net to get a copy of this message
> -----Original Message----- > From: Marcus Borger [mailto:marcus.boerger@t-online.de] > Sent: Monday, May 12, 2003 10:11 AM > To: Steven Brown > Cc: 'Theo Spears'; internals@lists.php.net > Subject: RE: [PHP-DEV] exceptions instead of errors > > > At 04:07 12.05.2003, Steven Brown wrote: > > >The problem will be that catch-all exception handling will cause all > >code your project uses to act differently, whether it was designed to > >expect exceptions thrown from internal functions or not. Same deal with > >nested uses of internal functions in pre-exception-aware code like in > >Theo's example. In those cases, the error handling code will get > >skipped completely, which definitely wasn't intended by whoever wrote > >the code. It's probably best from a compatibility standpoint to have to > >indicate at point of use (like with that '%' prefix) that the > >surrounding code understands exceptions. > > "try" is new so i cannot imagine any BC problem when try results in > errors being converted into exceptions. Maybe I'm just missing something, but if the decision to throw from a function that previously didn't use exceptions for error handling is based on if it's being used while in a try {} block, if you wrap your new php file with try {} but also make use of an old library, you've just changed the internal behavior of the library code, making it a BC issue. The PHP library you're calling for example never gets to handle errors as it was designed to, as every error unwinds the calls rather than returning null or whatever and being handled internally by the library. The only way to safely make use of older libraries in this case would be to not use mix them with exception-aware code, which would be a barrier to entry for people wanting to gradually migrate to php5.

« previous php.internals (#1455) next »