I want to execute a bunch of commands which throw exceptions but I’m having problems with the program executing properly.
This is the basic outline of my code:
try
{
command1 //all three throw exceptions
command2
command3
}
catch (Exception e)
{
//log the exception in a txt file and continue onto the next command
}
If command1 throws an exception, how do I get my program to move onto command2? In other words, how do I get back to the try-block and continue executing from where it left off? Thanks.
You can never get back into the try block once you’re in the catch block. You’d have to make three blocks to continue executing.