Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.2k views
in .NET FTP by
I need to be able to trap a "File In Use" exception so I can ignore it, but I need to be alerted to all other exceptions. I would like to know the best method of trapping that specific exception.

Thank You
Mike

3 Answers

0 votes
by (162k points)
You will first need to identify exactly what exception this is - presumably System.IO.IOException or a subclass.

You will then need to catch this exception, examine it for the text you are after, and rethrow the exception if it is not the one you are looking for. I can't see any simple way of doing it other than looking at the exception text - unless there is a subclass specifically for this exception (don't think so).

I need to be able to trap a "File In Use" exception so I can ignore it, but I need to be alerted to all other exceptions. I would like to know the best method of trapping that specific exception.

Thank You
Mike
0 votes
by
Bummer, if there was an error code to referance it would be much cleaner.
0 votes
by (162k points)
There may be but I can't see one mentioned in the documentation. Which is pretty poor design.

Bummer, if there was an error code to referance it would be much cleaner.

Categories

...