How do you handle exceptions from API/library in your code?
Posted
by
5YrsLaterDBA
on Stack Overflow
See other posts from Stack Overflow
or by 5YrsLaterDBA
Published on 2011-01-10T16:28:14Z
Indexed on
2011/01/10
16:53 UTC
Read the original article
Hit count: 152
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 ...
© Stack Overflow or respective owner