code: public static void setTaskFailureException(Collection<? extends WorkUnitState> taskStates, Throwable t) {
      for (WorkUnitState taskState : taskStates) {
        ((TaskState) taskState).setTaskFailureException(t);
      }
    }
docs: Sets the {@link ConfigurationKeys#TASK_FAILURE_EXCEPTION_KEY} for each given {@link TaskState} to the given
  {@link Throwable}.
  
  Make this method public as this exception catching routine can be reusable in other occasions as well.