code: def test_flat_datapoints_errors_are_caught(M, mocker):
      d = {}
      d = set_in(
          d,
          [
              "v1",
              "definitions",
              "data",
              "dvc.yaml",
              "data",
              "plot_id_1",
          ],
          {"x": "x", "y": {"file.json": "y"}},
      )
      d = set_in(
          d,
          ["v1", "sources", "data", "file.json", "data"],
          [{"x": 1, "y": 1}],
      )
      mocker.patch.object(
          VegaConverter, "flat_datapoints", side_effect=ValueError
      )
      (renderer_with_errors,) = match_defs_renderers(d)
      assert not renderer_with_errors.source_errors
      assert renderer_with_errors.definition_errors == {
          "v1": M.instance_of(ValueError)
      }
  
file_path: dvc/tests/unit/render/test_match.py
imports: import pytest
  from funcy import set_in
  from dvc.render import FIELD, FILENAME, REVISION
  from dvc.render.converter.vega import VegaConverter
  from dvc.render.match import PlotsData, _squash_plots_properties, match_defs_renderers
label_desc: Use image node_id 3 for calling a global function with example usage: test_flat_datapoints_errors_are_caught(M, mocker) without return types