It's a pity if we have places that do that - it really plays havoc with our 
dumps because any finallys below that catch block will get run and ruin the 
state of what the world looked like when the exception was raised.

-----Original Message-----
From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On 
Behalf Of Mark Hurd
Sent: Thursday, March 10, 2011 4:28 PM
To: ozDotNet
Subject: Re: Rethrowing exceptions

IIRC in the Reflector output of the Framework there are a number of similar 
constructs.

Some can be explained (such as the ones in the Microsoft.VisualBasic
namespace) where they explicitly WANT to lose the extra history so the 
exception looks like it is local to the VB routine and not from something 
deeper in the framework.

But there are other versions of this construct, including with just Throw, 
where I cannot confirm the reason. Of course, the shared source may explain it 
it due to logging and other code being commented out in the live build.

--
Regards,
Mark Hurd, B.Sc.(Ma.)(Hons.)


On 11 March 2011 08:57, Noon Silk <noonsli...@gmail.com> wrote:
> You did not mean to send this only to me, I'm sure :P
>
> Anyway, the point is that you can log something and then throw it up
> the chain for someone else to deal with. It's appropriate to log
> errors, but just because you log doesn't mean you can actually do
> anything better than crash (upwards).
>
> I think it should also be purely "throw"; as I believe "throw ex"
> loses some history.
>
>
> On Fri, Mar 11, 2011 at 9:24 AM, Arjang Assadi <arjang.ass...@gmail.com> 
> wrote:
>> What is the point of catching and throwing the same exception e.g. :
>>
>> catch (Exception ex)
>>            {
>>                throw ex;
>>            }
>>
>> ?
>>
>> Thank you in advance
>>
>> Regards
>>
>> Arjang
>>
>
> --
> Noon Silk
>

Reply via email to