Is this actually relevant to this bug?
It seems to me that this PR has two parts:

1) Fixing the bug which is when there is only one task, and that task has a error, we were not throwing the error.
2) Speeding up the case where there are multiple tasks but only one of them has an error.

Is the second part actually necessary? I think the code could be smaller without this performance change.