Re: E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
| From: | Roman Neuhauser | Date: | Fri, 05 Jan 2007 02:26:05 +0000 |
| Subject: | Re: E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246570@lists.php.net to get a copy of this message | ||
# ceo@l-i-e.com / 2007-01-04 18:45:07 -0600:
> On Thu, January 4, 2007 6:17 pm, Roman Neuhauser wrote:
> > Ok, but what harm has been done? something() presumably did the
> > fopen() for a reason, and couldn't work without the file handle and
> > couldn't succeed anyway.
> >
> > Sure, the program leaves the normal path at this moment unexpectedly,
> > and I can understand your frustration, but it has a bug, right? And
> > although the program contains a bug it hasn't crashed, it just entered
> > whatever orderly cleanup-and-exit path you had prepared.
> >
> > If fopen() didn't throw and the programmer didn't check the return
> > value (catch the exception in your version), you'd be screwed not
> > even knowing it.
> >
> > I think you brought a solid example of superiority of exceptions over
> > returning error codes.
>
> over returning error codes and not DOING anything with them? Sure.
>
> Over well-written code that does something with the returned error
> codes? no. Just a stylistic difference really, if all developers
> consistently did their error-checking, and did it fairly well.
>
> Alas, they don't.
That's exactly the point. Programmers don't check return values,
programs have bugs.
> And, suppose it's NOT an fopen() that was the problem deep in the guts
> of the other guy's code.
>
> Now you are catching an error and you have NO IDEA what the [bleep] to
> do with it.
If you really don't know what to do, then the right thing is probably an
orderly exit of the application, no?
> At least with error code returns, you are USUALLY dealing with a
> specific way to get those codes (in PHP, not C-style shell-style
> pass-the-buck error code bubble-up).
With error codes, you are USUALLY dealing with crashes and wrong
behavior. Compiled programs segfault, programs in PHP produce
unspecified numbers of E_NOTICE, E_WARNING, and quite easily drop dead
with an E_FATAL before returning to where you'd be complaining that you
don't know what to do with the error!
> And, of course, you just ignored the question of another catch block
> doing something you wish it didn't do...
I don't know what that means.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991