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 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