throwing exceptions out of a gui event handler

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to override the default behavior and prevent the framework
from catching any exceptions leaving these methods and allow the app to
handle them elsewhere?
 
Hello Dan,

You cant cacth exception that occured in the event handler unless you do
it in the handler itself.
As far as I remeber its because event executed on different thread and you
might not know when specific even happend and which one( in case more then
one handler was attached to it).

Try to define global application event handler and see if it works for you.

Hope it helps,
Oleg
 
Oleg Kap said:
Hello Dan,

You cant cacth exception that occured in the event handler unless you do
it in the handler itself.
As far as I remeber its because event executed on different thread and you
might not know when specific even happend and which one( in case more then
one handler was attached to it).

Try to define global application event handler and see if it works for you.

I currently have a global handler, and was trying to get the exception out
to it (most of my work is done by the gui calling DoFoo() methods). If I
can't do it I guess I could write a GlobalExceptionHandler(exception e)
method to call from the catch block and use type checking to figure out
exactly what type of exception was passed in, but that seems a rather ugly
solution. Alot of my processing is done in nonGui dlls so I can't display
messageboxes and shutdown at the point where they're thrown from.
 
Back
Top