code: def test_log_errors(
      tmp_dir, scm, dvc, run_copy_metrics, file, path_kwargs, capsys
  ):
      metric = [{"val": 2}, {"val": 3}]
      (tmp_dir / "metric_t.yaml").dump(metric)
      run_copy_metrics(
          "metric_t.yaml",
          "plot.yaml",
          plots=["plot.yaml"],
          single_stage=False,
          name="train",
      )
      scm.tag("v1")
  
      with open(file, "a", encoding="utf-8") as fd:
          fd.write("\nMALFORMED!")
  
      result = dvc.plots.show(onerror=onerror_collect)
      _, error = capsys.readouterr()
  
      assert isinstance(
          get_plot(result, **path_kwargs), YAMLFileCorruptedError
      )
      assert (
          "DVC failed to load some plots for following revisions: 'workspace'."
          in error
      )
  
imports: import json
  import os
  import pytest
  from dvc.cli import main
  from dvc.dvcfile import PROJECT_FILE
  from dvc.exceptions import OverlappingOutputPathsError
  from dvc.repo import Repo
  from dvc.repo.plots import PlotMetricTypeError, onerror_collect
  from dvc.utils.fs import remove
  from dvc.utils.serialize import EncodingError, YAMLFileCorruptedError, modify_yaml
  from tests.utils.plots import get_plot
label_desc: Use image node_id 11 for calling a global function with example usage: test_log_errors(tmp_dir, scm, dvc, run_copy_metrics, file, path_kwargs, capsys) without return types