Handling general exceptions using task flow templates