capturing errors so the workers will not die