How do you handle exceptions from API/library in your code?
- by 5YrsLaterDBA
I have the following lines of code:
FileInfo dbFile = new FileInfo(fileName);
dbFileSize = (long)dbFile.Length / 1024;//KB
There are 8 possible exceptions from new FileInfo(fileName) and dbFile.Length calls. I cannot just ignore them. I have to catch them.
What you are going to do with those 8 exceptions? Catch them separately (too many lines)? Catch only ONE by catching the super Exception excepton? or ...