catch errors in task run