code: def test_fallback_exception_message(tmp_dir, dvc, mocker, caplog):
      # When trying to pretty print exception messages, we fallback to old way
      # of printing things.
      mocker.patch(
          "dvc.utils.strictyaml.YAMLSyntaxError.__pretty_exc__",
          side_effect=ValueError,
      )
      mocker.patch(
          "dvc.utils.strictyaml.YAMLValidationError.__pretty_exc__",
          side_effect=ValueError,
      )
  
      # syntax errors
      dvc_file = tmp_dir / "dvc.yaml"
      dvc_file.write_text(MAPPING_VALUES_NOT_ALLOWED)
      assert main(["stage", "list"]) != 0
      assert (
          "unable to read: 'dvc.yaml', YAML file structure is corrupted"
          in caplog.text
      )
  
      caplog.clear()
      # validation error
      dvc_file.dump({"stages": {"stage1": None}})
      assert main(["stage", "list"]) != 0
      assert "dvc.yaml' validation failed" in caplog.text
  
file_path: dvc/tests/func/utils/test_strict_yaml.py
imports: import os
  import pytest
  from ruamel.yaml import __with_libyaml__
  from dvc.cli import main
label_desc: Use image node_id 6 for calling a global function with example usage: test_fallback_exception_message(tmp_dir, dvc, mocker, caplog) without return types