Re: exception policy for core
| From: | Johannes Schlüter | Date: | Thu, 18 Oct 2007 10:29:37 +0000 |
| Subject: | Re: exception policy for core | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32850@lists.php.net to get a copy of this message | ||
Hi,
On Thu, 2007-10-18 at 11:45 +0400, Antony Dovgal wrote:
> On 17.10.2007 20:09, Lukas Kahwe Smith wrote:
> > Hi,
> >
> > I remember that we discussed the question of exception throwing from
> > core in the very early days of php 5, when the suggestion of turning
> > all errors into exceptions first came up. I remember that we decided
> > that exceptions should only be thrown from core on constructor errors
> > by default. Along the lines of PDO, extensions could allow users to
> > explicitly enable an exception mode.
>
> First of all, I have to say that I see nothing wrong in using exceptions.
> Second, I see nothing wrong in using exceptions _in OO extensions_.
> And finally, I don't like the idea of having a special function in each and every
> extension to control it's error level.
> PDO was built this way from the very beginning, but making this some kind of standard would be
> a mistake IMO.
>
> You may not like exceptions, but that doesn't make them less useful.
The possibility of changing the error mode at run-time makes it quite
hard to read code. Since you always have to check the error mode of the
object you're currently looking at. Therefore I think we should avoid
adding more of these switches in future - especially on an per-object
basis.
johannes