betty.error module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.error module

Provide error handling utilities.

exception betty.error.FileNotFound

  Bases: `UserFacingError`, `FileNotFoundError`

  Raised when a file cannot be found.

  classmethod new(file_path: Path) → Self

    Create a new instance for the given file path.

exception betty.error.UserFacingError

  Bases: `Exception`, `Localizable`

  A localizable, user-facing error.

  This type of error is fatal, but fixing it does not require knowledge of Betty’s internals or the stack trace leading to the error. It must therefore have an end-user-friendly message, and its stack trace must not be shown.

  __init__(message: Localizable)
  localize(localizer: Localizer) → LocalizedStr

    Localize `self` to a human-readable string.

betty.error.serialize(error: _BaseExceptionT) → _BaseExceptionT

  Serialize an exception.

  This replaces the exception’s traceback object with the traceback formatted as a string.