code: def translate_graph_error(stages: List["Stage"]) -> Iterator[None]:
      try:
          yield
      except OverlappingOutputPathsError as exc:
          if exc.parent in [o for s in stages for o in s.outs]:
              msg = OVERLAPPING_PARENT_FMT.format(
                  out=exc.overlapping_out,
                  parent=exc.parent,
                  out_stage=exc.overlapping_out.stage.addressing,
              )
          else:
              msg = OVERLAPPING_CHILD_FMT.format(
                  out=exc.overlapping_out,
                  parent=exc.parent,
                  parent_stage=exc.parent.stage.addressing,
              )
          raise OverlappingOutputPathsError(  # noqa: B904
              exc.parent, exc.overlapping_out, msg
          )
      except OutputDuplicationError as exc:
          raise OutputDuplicationError(  # noqa: B904
              exc.output, set(exc.stages) - set(stages)
          )
  
file_path: dvc/dvc/repo/add.py
imports: import os
  from contextlib import contextmanager
  from typing import TYPE_CHECKING, Dict, Iterator, List, NamedTuple, Optional, Tuple, Union
  from dvc.exceptions import CacheLinkError, DvcException, OutputDuplicationError, OutputNotFoundError, OverlappingOutputPathsError
  from dvc.repo.scm_context import scm_context
  from dvc.ui import ui
  from dvc.utils import glob_targets, resolve_output, resolve_paths
  from .None import locked
label_desc: Use image node_id 3 for calling a global function with example usage: translate_graph_error(stages) without return types