Reputation: 1866
I am writing a program to read all files from an array. Suppose in between if any file is corrupt or any reason it will stop the execution in between and throw an exception I want to let the code running till end and at last it logged the error files instead of throwing exception?
Upvotes: 0
Views: 43
Reputation: 504
try{
doSomethingThatMayRaiseAndException();
}
catch (Exception e){
NotifyTheUserThatSomethingBadJustHappened();
}
Exception here is the base class for exceptions, you may need to use a more specific one if you want to provide the user with details. But right now, what you need to learn is how to deal with exceptions. You can use the link provided by Oded, it is a good start. Then note what is the raised exception you need to handle, and handle it.
Upvotes: 2