code: def test_dynamo_error(self, records):
      try:
          fn_opt = torch._dynamo.optimize("inductor")(dynamo_error_fn)
          fn_opt(*ARGS)
      except Exception:
          pass
      record = self.getRecord(records, "WON'T CONVERT")
      self.assertExpectedInline(
          munge_exc(record.getMessage()),
          """\
  WON'T CONVERT dynamo_error_fn test_logging.py line N
  due to:
  Traceback (most recent call last):
  torch._dynamo.exc.TorchRuntimeError: Failed running call_method add(*(FakeTensor(..., size=(1000, 1000), grad_fn=<MulBackward0>), FakeTensor(..., size=(10, 10))), **{}):
  Attempting to broadcast a dimension of length 10 at -1! Mismatching argument at index 1 had torch.Size([10, 10]); but expected shape should be broadcastable to [1000, 1000]
  
  from user code:
     File "test_logging.py", line N, in dynamo_error_fn
      output = output.add(torch.ones(10, 10))""",  # noqa: B950
      )
  
imports: import atexit
  import contextlib
  import functools
  import logging
  import os
  import re
  import unittest.mock
  import torch
  import torch._dynamo.test_case
  import torch._dynamo.testing
  import torch.distributed
  from torch._dynamo.testing import skipIfNotPy311
  from torch.nn.parallel import DistributedDataParallel
  from torch.testing._internal.common_utils import find_free_port, munge_exc
  from torch.testing._internal.inductor_utils import HAS_CUDA
  from torch.testing._internal.logging_utils import LoggingTestCase, make_logging_test, make_settings_test
label_desc: Use image node_id 5 for calling the LoggingTests obj's underlying member method code with example usage: obj.test_dynamo_error(records) without return types