"""General errors for the translation suite."""
from warnings import simplefilter as _simplefilter
[docs]
class ConfigurationError(TypeError):
"""Raised in case of bad configuration."""
[docs]
class ConfigurationChangedError(Exception):
"""See :meth:`.Translator.load_persistent_instance`."""
[docs]
class ConnectionStatusError(ConnectionError):
"""Raised when trying to perform operations in a bad online/offline state."""
[docs]
class TranslationError(Exception):
"""Base class for translation errors."""
[docs]
class MissingNamesError(TranslationError):
"""Raised if names could not be derived based on the data type, and aren't explicitly given."""
[docs]
class TooManyFailedTranslationsError(TranslationError):
"""Raised if too many IDs fail to translate."""
[docs]
class TranslationWarning(UserWarning):
"""Base class for translation warnings."""
[docs]
class TranslationAbortedWarning(TranslationWarning):
"""Translation was aborted.
Emitted when no derived names are mapped to sources.
"""
[docs]
class TranslationDisabledWarning(TranslationWarning):
"""Translation is globally disabled.
Emitted when :envvar:`ID_TRANSLATION_DISABLED` is set.
"""
_simplefilter("once", category=TranslationDisabledWarning)