Buckets:

download
raw
1.91 kB
class TranslationError(Exception):
"""Base exception for translation errors."""
def __init__(self, message: str, original_error: Exception = None):
self.message = message
self.original_error = original_error
super().__init__(self.message)
if original_error:
self.__cause__ = original_error
class LanguageDetectionError(TranslationError):
"""Exception raised when language detection fails."""
def __init__(
self, message: str = "Failed to detect language", original_error: Exception = None
):
super().__init__(message, original_error)
class TranslationProviderError(TranslationError):
"""Exception raised when the translation provider encounters an error."""
def __init__(
self,
provider: str,
message: str = "Translation provider error",
original_error: Exception = None,
):
self.provider = provider
full_message = f"[{provider}] {message}"
super().__init__(full_message, original_error)
class UnsupportedLanguageError(TranslationError):
"""Exception raised when the language is not supported."""
def __init__(
self,
language: str,
provider: str = None,
message: str = None,
original_error: Exception = None,
):
self.language = language
self.provider = provider
if message is None:
message = f"Language '{language}' is not supported"
if provider:
message += f" by {provider}"
super().__init__(message, original_error)
class TranslationConfigError(TranslationError):
"""Exception raised when translation configuration is invalid."""
def __init__(
self,
message: str = "Invalid translation configuration",
original_error: Exception = None,
):
super().__init__(message, original_error)

Xet Storage Details

Size:
1.91 kB
·
Xet hash:
8edf2fc98760849189bed872144b48866c97917c98eb363b7eb65607b1bee190

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.