betty.error module¶
Provide error handling utilities.
- exception betty.error.UserFacingError[source]¶
Bases:
Exception,LocalizableA 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.
- Parameters:
message (
betty.locale.Localizable)
- __init__(message: betty.locale.Localizable)[source]¶
- Parameters:
message (
betty.locale.Localizable)
- localize(localizer: betty.locale.Localizer) str[source]¶
Localize
selfto a human-readable string.- Parameters:
localizer (
betty.locale.Localizer)- Return type:
- betty.error.serialize(error: betty.error.BaseExceptionT) betty.error.BaseExceptionT[source]¶
Serialize an exception.
This replaces the exception’s traceback object with the traceback formatted as a string.
- Parameters:
error (
typing.TypeVar(BaseExceptionT, bound=BaseException))- Return type:
typing.TypeVar(BaseExceptionT, bound=BaseException)