Added error handling when a task is executed with no method