Re: How to force the program to continue after unhandled exception detection



On 8 Mar, 02:07, "Peter Duniho" <NpOeStPe...@xxxxxxxxxxxxxxxx> wrote:
On Fri, 07 Mar 2008 14:11:27 -0800, nano2k <adrian.rot...@xxxxxxxxxxx>  
wrote:

[...]
On this point, I'm stucked. Can't get rid of exception helper, even if
I want the exception to be handled by the general exception handler I
defined.

There's a fundamental mistake in your assumptions.  That is, you have not  
actually defined a "general exception handler".

You've defined a handler for the ThreadException _event_, but that's  
entirely different.  It doesn't handle an exception, it handles the event  
that's raised when an exception _isn't_ handled.

If you want the exception to be handled, you need to handle it.  With a  
try/catch block, not an event handler.

Pete

You're right, I made a mistake. I handled an event, that's right.
But the question remains. I want to get rid of exception helper and
let this event handler deal with the exception.
I have tons of places where exception handling is necessary and the
handler looks like: "If an unhadled exception raises, than simply
display its message and continue running!". Why should I write _the
same_ code each time?
Of course, there are also many many cases where I need to handle
specific types of exceptions and take the appropriate measures. I'm
not talking about these ones.
But in modern exception handling approach, implementing a general
exception catching mechanism is a _must_.
The only problem is that I get stucked in VSNET2005 when such an
"unhandled" exception occurs.
.



Relevant Pages

  • Re: Try Finally...
    ... Now we can protect every more or less specialized action ... an error indication (exception or error code) has to be ... an according exception handler can be inserted into the code. ... resources, as they are related to specific actions. ...
    (comp.lang.pascal.delphi.misc)
  • Re: WinForms bug? ThreadException not invoked on Exceptions in system code pre-processing the me
    ... Message Queue and invoking the appropriate handler. ... if an Exception is raised during the PRE-PROCESSING of a Windows ... And because any handling will probably fail if there is no memory, the CLR will terminate the application without attempting to call the ApplicationException or UnhandledException events. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: BackgroungWork taske ended for no appearent reason
    ... To do the same thing with Try/Catch blocks requires wrapping every file access with a Do While ... ... If there was any exception thrown in your DoWork event handler, ... If the operation raises an exception that your code does not handle, ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Frame-based exception handling problem on Server 2008
    ... In this case, the exception ends fatal, usually Cygwin creates a stack ... The Cygwin DLL is a POSIX ... handler is supposed to be *the* exception handler for Cygwin ... It also does not know if the signal handler returns or not. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Frame-based exception handling problem on Server 2008
    ... If I set a breakpoint to our exception ... points to the default handler, our exception handler is called just fine. ... typedef struct _exception_list ...
    (microsoft.public.win32.programmer.kernel)