class_docstr: Used to save a checkpoint on exception.
  
  Args:
      dirpath: directory to save the checkpoint file.
      filename: checkpoint filename. This must not include the extension.
  
  Raises:
      ValueError:
          If ``filename`` is empty.
  
  
  Example:
      >>> from lightning.pytorch import Trainer
      >>> from lightning.pytorch.callbacks import OnExceptionCheckpoint
      >>> trainer = Trainer(callbacks=[OnExceptionCheckpoint(".")])
code: def on_exception(
      self, trainer: "pl.Trainer", *_: Any, **__: Any
  ) -> None:
      # overwrite if necessary
      trainer.save_checkpoint(self.ckpt_path)
  
file_path: pytorch-lightning/src/lightning/pytorch/callbacks/on_exception_checkpoint.py
imports: import os
  from typing import Any
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.utilities.types import _PATH
  from lightning.pytorch.callbacks import Checkpoint
label_desc: Use image node_id 3 for calling the OnExceptionCheckpoint obj's underlying member method code with example usage: obj.on_exception(trainer) without return types