No need for the SVN Blame operation...I wrote that. :P That was soooo
long ago...there was no particularly compelling reason for why I did
it that way. I do think we should probably leave it in the throw so
that we don't just eat the exception. Jon, if you think that doing a
"throw" would result in better stack traceability, then by all means,
go ahead.
N.
On 7/12/07, Stewart Bright <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I agree, I think it's good practice to only ever throw a new exception (like
> 'throw new Exception(…)'), otherwise just rethrow as Jon suggests (catch{
> throw; } ). Obviously, it is also good practice to wrap and rethrow a new
> exception from within a catch handler when appropriate.
>
> -S
>
>
>
>
>
> From: Jonathan Resnick [mailto:[EMAIL PROTECTED]
> Sent: July 12, 2007 11:09 AM
> To: 'Stewart Bright'; [email protected]
> Subject: RE: [clearcanvas_dev] EventsHelper
>
>
>
> I was thinking that the model of event-driven programming is that the code
> that raises the event should not depend upon the successful execution of any
> of the handlers of the event (e.g. fire and forget), and therefore the
> exception should not be propagated back.
>
>
>
> But I think Stewart's argument probably trumps this concern. It would be
> worse to hide serious problems, so maybe it should always rethrow.
>
>
>
> I still wonder if "throw e" shouldn't be modified to "throw" (there is a
> slight difference in the way that .NET reports the stack trace).
>
>
>
> j
>
>
>
>
>
>
>
>
> ________________________________
>
>
> From: Stewart Bright [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 12, 2007 10:52 AM
> To: 'Jonathan Resnick'; [email protected]
> Subject: RE: [clearcanvas_dev] EventsHelper
>
>
>
>
> I think the reason it re-throws is because not doing so can potentially hide
> a serious problem from the user. Unless we decide that the EventsHelper
> only gets used to fire 'safe' events.
>
> -Stewart
>
>
>
>
>
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Jonathan Resnick
> Sent: July 12, 2007 10:45 AM
> To: [email protected]
> Subject: [clearcanvas_dev] EventsHelper
>
>
>
> I'm wondering why the EventsHelper class rethrows the exception? Having it
> rethrow happens to be quite useful for debugging, but conceptually I don't
> think it actually makes sense, and therefore it seems to me that in
> production code it should not rethrow the exception. The catch block
> currently looks like this:
>
>
>
> catch (Exception e)
>
> {
>
> Platform.Log(e, LogLevel.Error);
>
> throw e;
>
> }
>
>
>
> I think it should look like this:
>
>
>
> catch (Exception e)
>
> {
>
> Platform.Log(e, LogLevel.Error);
>
> #if DEBUG
>
> throw;
>
> #endif
>
> }
>
>
>
> Any thoughts? (Or, does anyone remember why the code is the way it is?)
>
>
>
> j
>
>
>
> __________ NOD32 2395 (20070712) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
> _______________________________________________
> dev mailing list
> [email protected]
> http://clearcanvas.ca/mailman/listinfo/dev_clearcanvas.ca
>
>
--
Norman Young
President & Founder
ClearCanvas Inc.
416-340-4800 x5954
[EMAIL PROTECTED]
Visit www.clearcanvas.ca
_______________________________________________
dev mailing list
[email protected]
http://clearcanvas.ca/mailman/listinfo/dev_clearcanvas.ca