add error handling program for all subtasks

About the end judgment of the subtask, I add a part communicating with TS