Re: catch replacing useful errorInfo



"tom.rmadilo" <tom.rmadilo@xxxxxxxxx> wrote:

And if you handle before an error actually occurs, then catch can be
reduced to the purpose of protecting shared resources from exceptional
conditions.

How can you handle an error before it happens? I also don't understand
why handling exceptional conditions for shared resources would be any
different from non-shared ones.

The point about errors is that the program is already not
doing the intended job, it is best to stop at that point and let
everyone know.

Not so. Sometimes the job involves attempting something that has a
significant chance of encountering an error, such as making a connection
to a network service to get a status report. A failure to connect can
be a valid result. The problem could be temporary, and is not fatal to
the program, which can try again later.

An error log going to stderr can record the gory
details, but the user needs to know at least the fact that the
application has had an application error, different from an error
caused by the user due to bad data or some other easily corrected
condition.

What do you mean by "application error"? That sounds like something
very different from what I usually see [catch] used for.

Catching exceptional errors is also one of the last things to be done.

Are you saying that it usually ends up that way, or that it *should* be
that way? My most robust programs come about when I take the time to
practice paranoid programming and write code to catch errors early in
the development cycle.

The reason is that during development you need to get as much error
tracing information as possible and also get very comfortable with how
you are going to use catch for your benefit and for the user's
benefit. It is also possible that you will cover up a bug in a package
you are just using, so delay use until code matures a little.

What you're saying is totally at odds to how I think of it. It's so
different that I have to wonder if your concept of an error is not the
same as mine. Or maybe you just have a mistaken idea of what [catch]
does and how to use it.
.