Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #12285

Re: Exception propagation

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Exception propagation
Date Sat, 10 Dec 2011 22:42:13 +1300
Lines 25
Message-ID <9kgnrmFhipU1@mid.individual.net> (permalink)
References <jbv58a$raq$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net uKHelpQLztjHhKLIwbfsYgXdWuTemnit4VOqJ5fdAvDNkVgNku
Cancel-Lock sha1:J9Jx9cpiiFbLM3jTtlWrhC99/JE=
User-Agent Mozilla/5.0 (X11; SunOS i86pc; rv:6.0.2) Gecko/20111003 Thunderbird/6.0.2
In-Reply-To <jbv58a$raq$1@dont-email.me>
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:12285

Show key headers only | View raw


On 12/10/11 09:28 PM, ittium wrote:
> Group,
>
> I have a situation where some of the  class/non-class methodsmake many
> levels of function calls, some of the function in this call hierarchy
> may throw exception, what is a good idea
>
> #1 inner function rethrow (by empty throw), such that exception is
> propagated back to the top level function.
>
> #2inner function does not throw (by empty throw), this exception will be
> by **default** propagated back to the top level routine (assuming
> intermediate routines are not catching the exception).
>
> #3 When it is a good idea that function(inner) receiving the exception
> or some intermediate function catch it and from there error event is
> propagated back through some error code.


The first place where it makes sense to catch the exception catches it 
and performs the appropriate recovery actions.  if there isn't an 
appropriate place, catch it in main, report and exit.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Exception propagation ittium <ittium@gmail.com> - 2011-12-10 13:58 +0530
  Re: Exception propagation Ian Collins <ian-news@hotmail.com> - 2011-12-10 22:42 +1300
  Re: Exception propagation Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-10 04:03 -0600
    Re: Exception propagation Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-10 06:12 -0600
  Re: Exception propagation Goran <goran.pusic@gmail.com> - 2011-12-10 10:29 -0800
    Re: Exception propagation Christopher <cpisz@austin.rr.com> - 2011-12-11 11:56 -0800
    Re: Exception propagation Ebenezer <woodbrian77@gmail.com> - 2011-12-11 21:44 -0800
      Re: Exception propagation Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-12 00:24 -0600
        Re: Exception propagation Ebenezer <woodbrian77@gmail.com> - 2011-12-12 02:50 -0800
          Re: Exception propagation Goran <goran.pusic@gmail.com> - 2011-12-12 04:06 -0800
            Re: Exception propagation Ebenezer <woodbrian77@gmail.com> - 2011-12-12 09:37 -0800
          Re: Exception propagation Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-12 11:16 -0600
      Re: Exception propagation Goran <goran.pusic@gmail.com> - 2011-12-12 00:31 -0800

csiph-web