Re: exception handling in event handlers

From: cody (please_dont.spam.deutronium_at_gmx.de)
Date: 04/24/04


Date: Sun, 25 Apr 2004 00:47:32 +0200


> In our organization, we made a decision to not have any unhandled
> exceptions inside event handler methods. If we didn't do this, one event
> handler's unhandled exceptions will stop other event handlers from getting
> called. We use the same approach for both UI and non-UI eventhandlers. In
UI
> eventhandlers we let the user know by popping up a msgbox while in non-UI
> event handlers, we just log the exception.
> Any thoughts to better the design are welcome.

What do you mean with no unhandled exceptions? Do you have a
try{}catch(Exception) in every Eventhandler or is it simply you say that you
try to catch all Exception that are thrown by you or at least expected?

But you are right, nobody who raises an event would expect an exception,
unless you specify a specific event this way that "failing" of the event is
answered with an exception.

-- 
cody
[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk


Relevant Pages

  • External component has thrown an exception
    ... I seem to get this exception when I open forms using ShowDialog() from ... event handlers. ... at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: debug .net runtime
    ... I do have it break on exception. ... the child relations of a dataset. ... It looks like there may be event handlers ... hooked to the OnCollectionChanging or OnCollectionChanged that are causing ...
    (microsoft.public.dotnet.framework)
  • Re: Exception from Managed Component being swallowed in Interop
    ... Ian Tompsett wrote: ... AFAIK, errors raised in event handlers for COM ... could set an error flag and throw the exception ...
    (microsoft.public.dotnet.framework.interop)
  • Re: customizing validation script-injection error page.
    ... All exceptions can be captured in two places, using event handlers: ... Page object has the Error property ... Your task is to test the class of exception object and redirect to the ... and "Visual Input Security" at http://www.peterblum.com/vise/home.aspx ...
    (microsoft.public.dotnet.framework.aspnet.security)