On Sun, Sep 2, 2012 at 9:39 AM, Anthony Ferrara <ircmax...@gmail.com> wrote: > Hi all, > > There's been a lot of discussion around whether or not to include > exceptions for core (no class implementations) errors or not. There's been > a lot said on both sides. However, I'd like to pose the question from a > different angle. > > Right now, I see the biggest problem with errors currently in PHP is that > there's no easy way of discerning between error types to be able to handle > them. Therefore it's easier to ignore the error than it is to handle it > bluntly. For example, I may want to distinguish between failure modes of > file_put_contents(). Right now, three types of errors can occur: File not > writable (can't open it), Can't write to file (write failed), and Partial > write only (but certain bytes were written). > http://lxr.php.net/xref/PHP_5_4/ext/standard/file.c#661 Right now, there's > no way short of parsing the error string to even attempt to distinguish > between them (arguably the first two could be treated the same, but the > third could lead to very dangerous situations). Which is non-trivial to say > the least... > > So, while I know there's some discontent about having the core raise > exceptions, let me ask the question differently: > > Without moving to exceptions, how could the current error and error I don't have a good sulotion.
but I definitely dis-agree of throwing exception anywhere.. People like me, like PHP is because it's simple, liking C . if you throw exception anywhere, then it will be a nightmare for me.. I don't care about what exact error happned, in most cases it runs well, if it failed, I can go to error log to find out why. but: try { file_put_contents(); } catch () { } try { file_put_contents(); } catch () { } try { file_put_contents(); } catch () { } ..... -1 thanks > handling mechanisms be improved to make the scenario I posted above easier. > To make handling errors just as easy as ignoring them (or preferably > easier)...? > > Thoughts? > > Anthony -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php