Re: Re: Are exceptions allowed in php core?

From: Date: Tue, 04 Sep 2012 15:05:44 +0000
Subject: Re: Re: Are exceptions allowed in php core?
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.internals 
Request: Send a blank email to internals+get-62799@lists.php.net to get a copy of this message
2012/9/4 Rasmus Lerdorf <rasmus@lerdorf.com>: > On 09/03/2012 04:31 PM, Alex Aulbach wrote: >> 2012/9/4 Gustavo Lopes <glopes@nebm.ist.utl.pt>: >>>> Following this logic, we'd have to convert all E_NOTICE and E_STRICT to >>>> fatal errors or exceptions - they are usually produced by programming >>>> errors and aren't meant to be caught by surrounding code (actually, >>>> can't). But I don't see anybody benefiting from this - as I don't >>>> see >>>> anybody benefiting from generator that will explode your application if >>>> you touch it twice. >> >> Nobody is forced to handle an notice-exception like a fatal exception. >> A notice-exception can be created write something into an error-log >> and tells PHP not to handle it any more (destroys itself). Could be >> all done in the construction of the exception. >> > > First, you got the quoting wrong. Please be more careful with that. Sorry, was written from very old laptop which has problems, when I mark text. > And second, huh? Uncaught exceptions are by definition fatal. There is > no such thing as a notice exception. If we go down that road refer to my > email describing condition error systems. Longer term I think a > condition system would make a lot of sense for PHP, but we definitely > don't want to introduce some sort of bastard non-fatal exception. Maybe I had not the right words to describe, what I mean: I would like to see both worlds (current error-handling and exceptions) in PHP - just as I need it. Your proposal sounds quite interesting. For example: If an SQL-query fails, the query itself isn't normally very interesting (it's wrong, ok). I need to know where it was created and how. The error is not in the database, it's most times in the PHP-program... -- Alex Aulbach

« previous php.internals (#62799) next »