code: def handle_error(
      graph: Optional["DiGraph"],
      on_error: str,
      exc: Exception,
      stage: "Stage",
  ) -> Set["Stage"]:
      import networkx as nx
  
      logger.warning(
          "%s%s", exc, " (ignored)" if on_error == "ignore" else ""
      )
      if not graph or on_error == "ignore":
          return set()
  
      dependents = set(
          nx.dfs_postorder_nodes(graph.reverse(), stage)
      ) - {stage}
      if dependents:
          names = _repr(dependents)
          msg = "%s %s will be skipped due to this failure"
          logger.warning(
              msg, "Stages" if len(dependents) > 1 else "Stage", names
          )
      return dependents
  
file_path: dvc/dvc/repo/reproduce.py
imports: from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, NoReturn, Optional, Set, Tuple, TypeVar, Union, cast
  from funcy import ldistinct
  from dvc.exceptions import ReproductionError
  from dvc.log import logger
  from dvc.repo.scm_context import scm_context
  from dvc.stage.cache import RunCacheNotSupported
  from dvc.utils import humanize
  from dvc.utils.collections import ensure_list
  from .None import locked
label_desc: Use image node_id 8 for calling a global function with example usage: handle_error(graph, on_error, exc, stage) and returns: dependents, set