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


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

Re: Exception propagation

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Exception propagation
Date 2011-12-10 22:42 +1300
Message-ID <9kgnrmFhipU1@mid.individual.net> (permalink)
References <jbv58a$raq$1@dont-email.me>

Show all headers | 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