Catching exceptions from a FileSystemWatcher event handler

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

Guest

Hi,

I'm using the FileSystemWatcher to monitor if there are changes to a file.
When the event is raised I do some stuff in a custom event handler sub
routine. It works fine.

However... ;-)

When errors do occur, I throw the exception from the catch part in my event
handler sub routine. But I'm not able to catch that exception outside my
event handler. How is this to be done?

Regards,
Ole
 
what are you throwing? You should be able to catch any cls compliant
exception. If it is non cls compliant, you will still be able to catch it
with a catch all filter but you won't be able do anything because there is
no exception object available. did i understand you right?

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc, Amazon, B&H etc
 
I'm throwing an general Exception e from my eventhandler and I want to catch
that exception in the function that created the watcher.

This function is looping/waiting for the event to occur and eventually
reaches a time out if no file has been found.

What I did belive should happend was that my function which created the
watcher also should catch the exception from my eventhandler like it would
have done if this was a regular call to a sub or function.

Ole





Alvin Bruney said:
what are you throwing? You should be able to catch any cls compliant
exception. If it is non cls compliant, you will still be able to catch it
with a catch all filter but you won't be able do anything because there is
no exception object available. did i understand you right?

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc, Amazon, B&H etc
-------------------------------------------------------------------------------


Ole said:
Hi,

I'm using the FileSystemWatcher to monitor if there are changes to a file.
When the event is raised I do some stuff in a custom event handler sub
routine. It works fine.

However... ;-)

When errors do occur, I throw the exception from the catch part in my
event
handler sub routine. But I'm not able to catch that exception outside my
event handler. How is this to be done?

Regards,
Ole
 
Back
Top