Re: Error Handling



If you put an On Error in a Sub Main then it will catch most (unhandled-)
exceptions, except those inside event handlers. These are not propagated
back down the stack beyond the start of the event, presumable because
there's no way of knowing exactly which previous handler would see it. This
is why Ken suggested an error trap in each event handler.

Otherwise, look for examples of SetUnhandledExceptionFilter.When all
frame-based exception handlers have been tried, this is the last-chance
catch-all.

You can also look at exceptions *before* any of the frame-based handlers
using AddVectoredExceptionHandler, although that doesn't exist in W2K and
below. A vectored exception handler gets called before any stack-based
handlers. Things like the debugger use these as they get called before any
handlers in the VB run-time or your own code. Such handlers are usually
non-intrusive -- meaning they see but don't actually "handle" the exceptions
themselves -- otherwise it could prevent other code working normally

Tony Proctor

"Jérémie Gent" <jer_kjr@xxxxxxxxxxx> wrote in message
news:OcGdRRAYHHA.1220@xxxxxxxxxxxxxxxxxxxxxxx
Hi there

Not sure if I should ask this here but it's worth a try
Is there really no way to set an Error Handling System for a whole
project,
without having to put 'On Error Goto ... ' + Error handler locally in each
procedure ?
Maybe some process could watch the Err object and fire an event when its
content changes ...
I don't really care if my application crashes, but I would need to know
what
the error number / description was and in which procedure (line number if
possible) the problem occured. Logging that info into a file would be
enough.

Thanks in advance if you know something about that or have any idea.

Jérémie




.