skipping an error to continue iterations

Hi
I am trying to run a large chunk of code inside for loop and store the output in matrices. There is an error message for certain samples and I want to skip the iterations with error message and move to next iteration. Can anyone please explain, how can I do that.