private Task checkIfTaskFailed(final StateUpdater.RemovedTaskResult removedTaskResult,
                                   final Map<TaskId, RuntimeException> failedTasks) {
        final Task task = removedTaskResult.task();
        if (removedTaskResult.exception().isPresent()) {
            failedTasks.put(task.id(), removedTaskResult.exception().get());
            tasks.addTask(task);
            return null;
        }
        return task;
    }
@throws TaskMigratedException if the task producer got fenced (EOS only)
@throws StreamsException fatal error while creating / initializing the task

public for upgrade testing only
streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java