Hi everyone,
got a quick question about Try-Catch blocks. I often need to iterate through objects and do some processing, but simply want each iteration to continue if an exception arises. I’m using try-catch blocks for this. I’m not trying to handle the exception, just want to prevent it from stopping the iteration. Something like:
for each f as folderItem in arrayOfFiles
try
'do some processing which could create potential exceptions
catch
'no code here, really, but just continue the loop with the next item
end try
next
Since I’m not specifying any type of exception in the catch statement, I assume it’s catching any runtime exception. Of course, I don’t have access to the actual exception instance so cannot make tests on it, which is fine for me in this particular case.
What makes me uncertain is the language reference mentions that : [quote]You should try to avoid catching the RuntimeException superclass as this could cause prevent threads from properly being killed or apps from quitting if an exception is raised during those events.[/quote]
So is there another way to go about this other that checking all foreseeable exceptions that could be raised by the code and re-raising the others?