PC Review


Reply
Thread Tools Rate Thread

Catching exceptions from a FileSystemWatcher event handler

 
 
=?Utf-8?B?T2xl?=
Guest
Posts: n/a
 
      5th Aug 2005
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


 
Reply With Quote
 
 
 
 
Alvin Bruney [Microsoft MVP]
Guest
Posts: n/a
 
      5th Aug 2005
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" <(E-Mail Removed)> wrote in message
news:30CA8812-1C45-4012-BE9F-(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
=?Utf-8?B?T2xl?=
Guest
Posts: n/a
 
      10th Aug 2005
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 [Microsoft MVP]" wrote:

> 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" <(E-Mail Removed)> wrote in message
> news:30CA8812-1C45-4012-BE9F-(E-Mail Removed)...
> > 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
> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Catching Exceptions Jeffrey Walton Microsoft C# .NET 5 25th Nov 2007 12:05 AM
catching exceptions bitshift Microsoft Dot NET Framework 4 31st Aug 2007 10:51 AM
throwing exceptions out of a gui event handler =?Utf-8?B?RGFuIE5lZWx5?= Microsoft C# .NET 2 27th Oct 2005 01:21 PM
Catching exceptions in an OnPaint PictureBox event Nuno Magalhaes Microsoft C# .NET 1 26th Sep 2005 02:14 PM
FileSystemWatcher: problems with event-catching Andreas Microsoft C# .NET 1 2nd Feb 2004 01:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:04 PM.