Re: C++ Question: try-throw-catch



In article <1182825713.122029.269490@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Brandon J. Van Every" <bvanevery@xxxxxxxxx> wrote:

On Jun 25, 10:40 am, Miss Elaine Eos <M...@xxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
In article <1182747801.427938.107...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Brandon J. Van Every" <bvanev...@xxxxxxxxx> wrote:

Debug logs are
useful, but passing errors up the call chain isn't. Most of the time
it's a verbose way of saying, "I have no idea what to do, please crash
me."

Often, it's a way of saying "it's not appropriate for me to decide what
to do, I'll let the caller handle it.

IO routines do this, commonly. It's rarely appropriate for an IO
routine to decide how to handle an exception, and "please crash" is
almost never what you ultimately want to have happen.

I'll reiterate the point in case it's not clear. You're prototyping.
You don't know how you're going to handle your exceptions. You pass
the buck to the caller, because as you said, it's not appropriate for
the function to handle the exception. Nor is it appropriate to
deliberately crash.

Oh, sure -- I wasn't arguing that point. I was only pointing out that
the world is neither black nor white -- there are situations in which
try-catch is appropriate, those where throwing the error up is
appropriate and those where error-logging/crashing are appropriate.

I only meant to point out that it's just as bad to always use one
technique as to never use it -- "the right tool for the right job" and
all that.

--
Please take off your pants or I won't read your e-mail.
I will not, no matter how "good" the deal, patronise any business which sends
unsolicited commercial e-mail or that advertises in discussion newsgroups.
.



Relevant Pages

  • Re: Validating file names
    ... running Novel, from your G: running Linux file system, from your H: running ... I am not saying one does not exist! ... file file and handle any exceptions that were thrown. ... If an exception is thrown then the specified ...
    (microsoft.public.dotnet.languages.vb)
  • Re: (part 30) Han from China answers your C questions
    ... If at that point you chose to allow the program to crash, ... And the suggested "solution" was presented as if it was a _full_ _fix_ for the error, i.e. as a variant that doesn't suffer from the error at all. ... All I'm saying is that this claim is not true, and that the updated code also suffers from the same error, although the immediate consequences of that error are not the same. ... None of what I said in any way means that anyone should avoid normal civilized and graceful error handling in their programs and force their programs to crash instead. ...
    (comp.lang.c)
  • Re: Ubuntu 8.04 Is Ready to Take On Windows
    ... and crash his or her system. ... As for removing packages so as to rend the system unusable, ... without getting full flagged warnings. ... you could have a message saying that "beware! ...
    (Ubuntu)
  • Re: Hamilton, Rosberg hit with grid penalty
    ... He had nowhere to go and a wall to his right. ... He could go straight on and crash, turn right and crash hard (but no-one ... I'm not saying he didn't _swerve_, ...
    (rec.autos.sport.f1)
  • Re: Coding Nothing in C#
    ... So you are saying that Null should work in this case? ... because of the null reference you are supplying by taking a peek at the ... Assuming that the exception is being thrown on the line that calls the ... Dim oDispatch As New Company.Queuing.CompanyDispatchQueue ...
    (microsoft.public.dotnet.languages.csharp)