axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjiva Weerawarana" <sanj...@opensource.lk>
Subject Re: Exception handling - trivial try catch blocks
Date Tue, 29 Jun 2004 09:19:21 GMT
If there's a catch and a re-throw of an exception it may be useful to do
what's
done in Java: constructor the new exception with the old one referenced in
it. (Look at the "targetException" field of java.lang.Exception for
example.)

That way all the "old" info is there and the catcher can add additional
info.

Sanjiva.

----- Original Message ----- 
From: "damitha kumarage" <damitha@opensource.lk>
To: "Apache AXIS C Developers List" <axis-c-dev@ws.apache.org>
Sent: Tuesday, June 29, 2004 12:34 PM
Subject: Re: Exception handling - trivial try catch blocks


> On Thu, 2004-06-24 at 13:52, John Hawkins wrote:
> >
> >
> > If, when throwing the exception (A new exception?) we add more specific
> > information about the originally caught exception then this is worth
doing.
> Yes we need to let the new thrower to append a message to the exception
> he caught.
>
> > If we simply throw a new exception with no new information specific to
the
> > catch then these can probably be removed?
> yes
> >
> > However, if we are not using the information gained from the specific
> > exception then we are missing a trick. The key point is that when the
> > exception finally gets to the application it needs as much information
as
> > possible about the original exception to enable the application to
> > determine what to do next.
> yes
>
> thanks
> damitha
> >
> >
> > John Hawkins
> >
> >
> >
> >
> >
> >              damitha kumarage
> >              <damitha@opensour
> >              ce.lk>
To
> >                                        Apache AXIS C Developers List
> >              24/06/2004 08:34          <axis-c-dev@ws.apache.org>
> >
cc
> >
> >              Please respond to
Subject
> >               "Apache AXIS C           Re: Exception handling - trivial
> >              Developers List"          try catch blocks
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Thu, 2004-06-24 at 12:20, Susantha Kumara wrote:
> > > Hi all,
> > >
> > >
> > >
> > > I see that in Axis code there are trivial try…catch blocks (in
> > > approximately 50 places) like following,
> > >
> > >
> > >
> > >     try {
> > >
> > >     ……..
> > >
> > >     ……..
> > >
> > >     }
> > >
> > >     catch(AxisTransportException& e)
> > >
> > >     {
> > >
> > >         throw;
> > >
> > >     }
> > >
> > >     catch(AxisException& e)
> > >
> > >     {
> > >
> > >         throw;
> > >
> > >     }
> > >
> > >     catch(...)
> > >
> > >     {
> > >
> > >         throw;
> > >
> > >     }
> > >
> > >
> > >
> > > This kind of code avoids compiler errors in Java. But in C++ this has
> > > no effect other than increasing the size of code.
> > >
> > > Please correct me if I am wrong.
> > >
> > >
> > >
> > > Do we have any plans to do something with the catched exception other
> > > than re-throwing it ?. If so we need this blocks. If not I suggest
> > > that we remove them safely.
> >
> > Does it affect the performance if we keep them?. In java it is advised
> > to avoid unneccessary try blocks. So I guess it is same with C++.
> > I put them while adding exception handling capabilities to the code
> > and guessed that responsible developer might have something to do
> > with the exceptions caught.
> > OK, if it's a problems let's remove them and let the developer
> > add it if neccessary.
> >
> > thanks
> > damitha
> > >
> >
>
>


Mime
View raw message