Re: C++ Question: try-throw-catch
- From: Miss Elaine Eos <Misc@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Jun 2007 19:55:06 -0700
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.
.
- Follow-Ups:
- Re: C++ Question: try-throw-catch
- From: Brandon J. Van Every
- Re: C++ Question: try-throw-catch
- References:
- Re: C++ Question: try-throw-catch
- From: Brandon J. Van Every
- Re: C++ Question: try-throw-catch
- From: Miss Elaine Eos
- Re: C++ Question: try-throw-catch
- From: Brandon J. Van Every
- Re: C++ Question: try-throw-catch
- Prev by Date: Re: C++ Question: try-throw-catch
- Next by Date: Re: C++ Question: try-throw-catch
- Previous by thread: Re: C++ Question: try-throw-catch
- Next by thread: Re: C++ Question: try-throw-catch
- Index(es):
Relevant Pages
|