Steve Bennett schrieb:
On 6/7/06, Tim Starling t.starling@physics.unimelb.edu.au wrote:
Assuming this is a general question not specifically related to MediaWiki, the general answer is that exceptions should only be used for exceptional circumstances, and likely failures are better off handled with return codes. It's better to use exceptions for weird things like running out of memory, suddenly being unable to access the disk, or an assertion failing, rather than something as banal as a bad filename being supplied, for instance.
Do you have some sort of justification for this view?
Just what I've read.
For C++, I totally ageee with this. It's just the way it's done, and proved to be a viable solution.
I see no reason to stray from this well-established path in PHP. Exceptions are to be used for, well, exceptional events. Bad user input is normal. Hard drive going down is exceptional.
Magnus