handle exceptions in tasks with results