Source code for tgbox.errors
"""This module stores all Tgbox-unique exceptions."""
[docs]
class TgboxException(Exception):
"""Base TGBOX Exception"""
def __init__(self, message=None):
super().__init__(message or self.__doc__)
# Base Exceptions
[docs]
class NotInitializedError(TgboxException):
"""The class you try to use isn't initialized"""
[docs]
class PathIsDirectory(TgboxException):
"""Specified path is Directory"""
[docs]
class LimitExceeded(TgboxException):
"""Value is out of allowed range"""
[docs]
class NotATgboxFile(TgboxException):
"""This Telegram message isn't a TGBOX file"""
[docs]
class InvalidFile(TgboxException):
"""Specified file is invalid"""
# Crypto Exceptions
[docs]
class IncorrectKey(TgboxException):
"""Specified key is invalid."""
[docs]
class ModeInvalid(TgboxException):
"""You should use only decryption or encryption per class"""
[docs]
class AESError(TgboxException):
"""Invalid AES configuration"""
# Tools Exceptions
[docs]
class ConcatError(TgboxException):
"""You must concat metadata before using OpenPretender"""
[docs]
class PreviewImpossible(TgboxException):
"""Can\'t create file preview"""
[docs]
class DurationImpossible(TgboxException):
"""Can\'t get media duration"""
# Database Exceptions
[docs]
class InUseException(TgboxException):
"""The DB already exists and in use"""
[docs]
class BrokenDatabase(TgboxException):
"""Can\'t parse SQLite DB"""
# RemoteBox Exceptions
[docs]
class RemoteFileNotFound(TgboxException):
"""Seems that there is no requested by you file"""
[docs]
class SessionUnregistered(TgboxException):
"""Session you trying to use was disconnected"""
[docs]
class RemoteBoxInaccessible(TgboxException):
"""The RemoteBox you try to use is inaccessible"""
[docs]
class NotEnoughRights(TgboxException):
"""You don't have rights for this action"""
[docs]
class FastSyncDisabled(TgboxException):
"""Fast sync was disabled in Box defaults"""
# LocalBox Exceptions
[docs]
class AlreadyImported(TgboxException):
"""LocalBox have file with same ID"""
[docs]
class NotImported(TgboxException):
"""The file you try to retrieve wasn't imported yet"""
[docs]
class FingerprintExists(TgboxException):
"""File with the same file path already uploaded to the Box"""