code: def encode_exception(o):
      if isinstance(o, Exception):
          return {"type": type(o).__name__, "msg": str(o)}
      raise TypeError
  
file_path: dvc/dvc/utils/serialize/_json.py
imports: import json
  from funcy import contextmanager, reraise
  from ._common import ParseError, _dump_data, _load_data, _modify_data
label_desc: Use image node_id 6 for calling a global function with example usage: encode_exception(o) and returns: dict