The requirement: On an error (thrown exception), the file being processed should be moved to the folder for files with errors (app.config setting).
The problem: The only way that I can of handling this is to have a nested Try/Catch inside of the main Try/Catch to try to move the file, that way if the move fails, another exception is thrown. I know that I can do my best to make sure the directory exists, rights are given, but since it is a network drive... I just know an error is bound to happen at some point.
Example
Try
(Do Some Logic, but an error happens)
Catch ex As Exception
Try
(Attempt to move file)
Catch exinner as Exception
Throw New Exception("Cannot move file to Error Directory", innerex)
End Try
(Raise Error Event for logging by form/batch app)
End Try
Actually that came out even more horrible than what I was thinking it would look like.
Now I know I am doing something wrong. How should I really be trying to handle a possible error occuring in the catch, so that I can still move files and try to call my event?