code: def test_scheduler_raise_exceptions(self) -> None:
      scheduler = Scheduler(
          experiment=get_branin_experiment(),
          generation_strategy=get_generation_strategy(),
          options=SchedulerOptions(
              total_trials=0,
              tolerated_trial_failure_rate=0.2,
              init_seconds_between_polls=10,
          ),
      )
  
      with mock.patch.object(
          scheduler,
          "get_improvement_over_baseline",
          side_effect=Exception("test_exception"),
      ):
          record = SchedulerCompletedRecord.from_scheduler(
              scheduler=scheduler
          )
      flat = record.flatten()
      self.assertEqual(flat["improvement_over_baseline"], float("-inf"))
  
imports: from typing import cast, Dict
  from unittest import mock
  from ax.core.experiment import Experiment
  from ax.core.objective import Objective
  from ax.core.optimization_config import OptimizationConfig
  from ax.metrics.branin import BraninMetric
  from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
  from ax.modelbridge.registry import Models
  from ax.runners.synthetic import SyntheticRunner
  from ax.service.scheduler import get_fitted_model_bridge, Scheduler, SchedulerOptions
  from ax.telemetry.experiment import ExperimentCompletedRecord, ExperimentCreatedRecord
  from ax.telemetry.generation_strategy import GenerationStrategyCreatedRecord
  from ax.telemetry.scheduler import SchedulerCompletedRecord, SchedulerCreatedRecord
  from ax.utils.common.constants import Keys
  from ax.utils.common.testutils import TestCase
  from ax.utils.testing.core_stubs import get_branin_experiment, get_branin_search_space
  from ax.utils.testing.modeling_stubs import get_generation_strategy
label_desc: Use image node_id 3 for calling the TestScheduler obj's underlying member method code with example usage: obj.test_scheduler_raise_exceptions() without return types