fix #2781, ensure that the task that handles an error actually has an active handler