2019-11-19 19:57:14 +01:00
|
|
|
from .base import BaseError
|
2018-08-04 23:19:10 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class InitializationError(BaseError):
|
|
|
|
"""
|
|
|
|
**Daemon `start` and other CLI command failures (non-recoverable)**
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class ClientError(InitializationError):
|
|
|
|
"""
|
|
|
|
Error codes reported by clients connecting to `lbrynet` daemon.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class RPCConnectionError(ClientError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Failed to establish HTTP connection to `lbrynet`. (Is it running?)")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
2017-09-27 23:23:41 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class RPCUnresponsiveError(ClientError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("HTTP connection established but daemon is not responding to commands.")
|
2017-09-27 23:23:41 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class WebSocketConnectionError(ClientError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("WebSocket connection established but daemon is not responding to commands.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
2017-09-27 23:23:41 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class WebSocketUnresponsiveError(ClientError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Failed to establish WebSocket connection to `lbrynet`. (Is it running?)")
|
2017-09-27 23:23:41 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class HardwareError(InitializationError):
|
|
|
|
"""
|
|
|
|
Enough of `lbrynet` was able to start to determine external factors causing eventual failure.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-03-31 19:42:27 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class OutOfSpaceError(HardwareError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Out of disk space.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class OutOfRAMError(HardwareError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Out of RAM.")
|
2017-07-07 22:37:35 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class EnvironmentError(InitializationError):
|
|
|
|
"""
|
|
|
|
Internal factors preventing `lbrynet` from bootstrapping itself.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2017-07-07 22:37:35 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class IncompatiblePythonError(EnvironmentError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Incompatible version of Python.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class IncompatibleDependencyError(EnvironmentError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Incompatible version of some library.")
|
2018-08-23 01:14:14 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class ConfigurationError(InitializationError):
|
|
|
|
"""
|
|
|
|
Configuration errors.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2018-08-23 01:14:14 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class CannotWriteConfigurationError(ConfigurationError):
|
|
|
|
"""
|
|
|
|
When writing the default config fails on startup, such as due to permission issues.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, path):
|
|
|
|
super().__init__(f"Cannot write configuration file '{path}'.")
|
2018-08-23 01:14:14 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class CannotOpenConfigurationError(ConfigurationError):
|
|
|
|
"""
|
|
|
|
Can't open the config file user provided via command line args.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, path):
|
|
|
|
super().__init__(f"Cannot find provided configuration file '{path}'.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class CannotParseConfigurationError(ConfigurationError):
|
|
|
|
"""
|
|
|
|
Includes the syntax error / line number to help user fix it.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, path):
|
|
|
|
super().__init__(f"Failed to parse the configuration file '{path}'.")
|
2016-07-26 04:46:04 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class ConfigurationMissingError(ConfigurationError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, path):
|
|
|
|
super().__init__(f"Configuration file '{path}' is missing setting that has no default / fallback.")
|
2017-02-28 02:18:57 +01:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class ConfigurationInvalidError(ConfigurationError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, path):
|
|
|
|
super().__init__(f"Configuration file '{path}' has setting with invalid value.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
2015-09-01 23:49:26 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class CommandError(InitializationError):
|
|
|
|
"""
|
|
|
|
Errors preparing to execute commands.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class CommandDoesNotExistError(CommandError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
|
|
|
super().__init__(f"Command '{command}' does not exist.")
|
|
|
|
|
|
|
|
|
|
|
|
class CommandDeprecatedError(CommandError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
|
|
|
super().__init__(f"Command '{command}' is deprecated.")
|
|
|
|
|
|
|
|
|
|
|
|
class CommandInvalidArgumentError(CommandError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
|
|
|
super().__init__(f"Invalid arguments for command '{command}'.")
|
|
|
|
|
|
|
|
|
|
|
|
class CommandTemporarilyUnavailableError(CommandError):
|
|
|
|
"""
|
|
|
|
Such as waiting for required components to start.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
|
|
|
super().__init__(f"Command '{command}' is temporarily unavailable.")
|
2017-06-09 19:39:55 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class CommandPermanentlyUnavailableError(CommandError):
|
|
|
|
"""
|
|
|
|
such as when required component was intentionally configured not to start.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
|
|
|
super().__init__(f"Command '{command}' is permanently unavailable.")
|
|
|
|
|
|
|
|
|
|
|
|
class NetworkingError(BaseError):
|
|
|
|
"""
|
|
|
|
**Networking**
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ConnectivityError(NetworkingError):
|
|
|
|
"""
|
|
|
|
General connectivity.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class NoInternetError(ConnectivityError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("No internet connection.")
|
|
|
|
|
|
|
|
|
|
|
|
class NoUPnPSupportError(ConnectivityError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Router does not support UPnP.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletConnectivityError(NetworkingError):
|
|
|
|
"""
|
|
|
|
Wallet server connectivity.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class WalletConnectionError(WalletConnectivityError):
|
|
|
|
"""
|
|
|
|
Should normally not need to be handled higher up as `lbrynet` will retry other servers.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Failed connecting to a lbryumx server.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletConnectionsError(WalletConnectivityError):
|
|
|
|
"""
|
|
|
|
Will need to bubble up and require user to do something.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Failed connecting to all known lbryumx servers.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletConnectionDroppedError(WalletConnectivityError):
|
|
|
|
"""
|
|
|
|
Maybe we were being bad?
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("lbryumx droppped our connection.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletDisconnectedError(NetworkingError):
|
|
|
|
"""
|
|
|
|
Wallet connection dropped.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class WalletServerSuspiciousError(WalletDisconnectedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Disconnected from lbryumx server due to suspicious responses. *generic*")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletServerValidationError(WalletDisconnectedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Disconnected from lbryumx server due to SPV validation failure.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletServerHeaderError(WalletDisconnectedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Disconnected from lbryumx server due to incorrect header received.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletServerVersionError(WalletDisconnectedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Disconnected from lbryumx server due to incompatible protocol version.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletServerUnresponsiveError(WalletDisconnectedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Disconnected from lbryumx server due to unresponsiveness.")
|
|
|
|
|
|
|
|
|
|
|
|
class DataConnectivityError(NetworkingError):
|
|
|
|
"""
|
|
|
|
P2P connection errors.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class DataNetworkError(NetworkingError):
|
|
|
|
"""
|
|
|
|
P2P download errors.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class DataDownloadError(DataNetworkError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Failed to download blob. *generic*")
|
|
|
|
|
|
|
|
|
|
|
|
class DataUploadError(NetworkingError):
|
|
|
|
"""
|
|
|
|
P2P upload errors.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class DHTConnectivityError(NetworkingError):
|
|
|
|
"""
|
|
|
|
DHT connectivity issues.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class DHTProtocolError(NetworkingError):
|
|
|
|
"""
|
|
|
|
DHT protocol issues.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class BlockchainError(BaseError):
|
|
|
|
"""
|
|
|
|
**Blockchain**
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TransactionRejectionError(BlockchainError):
|
|
|
|
"""
|
|
|
|
Transaction rejected.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TransactionRejectedError(TransactionRejectionError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Transaction rejected, unknown reason.")
|
|
|
|
|
|
|
|
|
|
|
|
class TransactionFeeTooLowError(TransactionRejectionError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Fee too low.")
|
|
|
|
|
|
|
|
|
|
|
|
class TransactionInvalidSignatureError(TransactionRejectionError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Invalid signature.")
|
|
|
|
|
|
|
|
|
2019-11-19 20:29:04 +01:00
|
|
|
class BalanceError(BlockchainError):
|
|
|
|
"""
|
|
|
|
Errors related to your available balance.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 20:29:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
class InsufficientFundsError(BalanceError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
determined by wallet prior to attempting to broadcast a tx; this is different for example from a TX
|
|
|
|
being created and sent but then rejected by lbrycrd for unspendable utxos.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 20:29:04 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Insufficient funds.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ChannelSigningError(BlockchainError):
|
|
|
|
"""
|
|
|
|
Channel signing.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ChannelKeyNotFoundError(ChannelSigningError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Channel signing key not found.")
|
|
|
|
|
|
|
|
|
|
|
|
class ChannelKeyInvalidError(ChannelSigningError):
|
|
|
|
"""
|
|
|
|
For example, channel was updated but you don't have the updated key.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Channel signing key is out of date.")
|
|
|
|
|
|
|
|
|
2019-11-19 20:13:15 +01:00
|
|
|
class GeneralResolveError(BlockchainError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
Errors while resolving urls.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-11-19 20:13:15 +01:00
|
|
|
class ResolveError(GeneralResolveError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 20:29:04 +01:00
|
|
|
def __init__(self, url):
|
|
|
|
super().__init__(f"Failed to resolve '{url}'.")
|
2017-06-09 19:39:55 +02:00
|
|
|
|
2018-08-04 23:19:10 +02:00
|
|
|
|
2019-11-19 20:13:15 +01:00
|
|
|
class ResolveTimeoutError(GeneralResolveError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 20:29:04 +01:00
|
|
|
def __init__(self, url):
|
|
|
|
super().__init__(f"Failed to resolve '{url}' within the timeout.")
|
2017-06-09 19:39:55 +02:00
|
|
|
|
2018-08-04 23:19:10 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobError(BaseError):
|
|
|
|
"""
|
|
|
|
**Blobs**
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2016-07-29 00:48:29 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobAvailabilityError(BlobError):
|
|
|
|
"""
|
|
|
|
Blob availability.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2015-09-01 23:49:26 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobNotFoundError(BlobAvailabilityError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Blob not found.")
|
2015-09-01 23:49:26 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobPermissionDeniedError(BlobAvailabilityError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Permission denied to read blob.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobTooBigError(BlobAvailabilityError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Blob is too big.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobEmptyError(BlobAvailabilityError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Blob is empty.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
class BlobDecryptionError(BlobError):
|
|
|
|
"""
|
|
|
|
Decryption / Assembly
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobFailedDecryptionError(BlobDecryptionError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Failed to decrypt blob.")
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class CorruptBlobError(BlobDecryptionError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Blobs is corrupted.")
|
2015-09-04 22:22:02 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobEncryptionError(BlobError):
|
|
|
|
"""
|
|
|
|
Encrypting / Creating
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2015-09-04 22:22:02 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobFailedEncryptionError(BlobEncryptionError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Failed to encrypt blob.")
|
2015-09-16 22:27:46 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobRelatedError(BlobError):
|
2017-02-16 15:09:21 +01:00
|
|
|
"""
|
2019-11-19 19:57:14 +01:00
|
|
|
Exceptions carried over from old error system.
|
2017-02-16 15:09:21 +01:00
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2017-02-16 15:09:21 +01:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class DownloadCancelledError(BlobRelatedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Download was canceled.")
|
2016-09-20 22:58:30 +02:00
|
|
|
|
2016-09-27 19:52:44 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class DownloadSDTimeoutError(BlobRelatedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, download):
|
|
|
|
super().__init__(f"Failed to download sd blob {download} within timeout.")
|
2016-09-20 22:58:30 +02:00
|
|
|
|
2016-10-15 00:25:37 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class DownloadDataTimeoutError(BlobRelatedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, download):
|
|
|
|
super().__init__(f"Failed to download data blobs for sd hash {download} within timeout.")
|
2016-09-22 03:36:06 +02:00
|
|
|
|
2016-10-15 00:25:37 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class InvalidStreamDescriptorError(BlobRelatedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
|
|
|
super().__init__(f"{message}")
|
2017-07-20 00:15:07 +02:00
|
|
|
|
2018-07-24 18:03:43 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class InvalidDataError(BlobRelatedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
|
|
|
super().__init__(f"{message}")
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidBlobHashError(BlobRelatedError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
|
|
|
super().__init__(f"{message}")
|
2018-02-09 17:29:37 +01:00
|
|
|
|
2018-07-24 18:03:43 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class ComponentError(BaseError):
|
|
|
|
"""
|
|
|
|
**Components**
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ComponentStartConditionNotMetError(ComponentError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, components):
|
|
|
|
super().__init__(f"Unresolved dependencies for: {components}")
|
|
|
|
|
|
|
|
|
|
|
|
class ComponentsNotStartedError(ComponentError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
|
|
|
super().__init__(f"{message}")
|
|
|
|
|
|
|
|
|
|
|
|
class CurrencyExchangeError(BaseError):
|
|
|
|
"""
|
|
|
|
**Currency Exchange**
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
|
2018-07-24 18:03:43 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class InvalidExchangeRateResponseError(CurrencyExchangeError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, source, reason):
|
|
|
|
super().__init__(f"Failed to get exchange rate from {source}: {reason}")
|
|
|
|
|
|
|
|
|
|
|
|
class CurrencyConversionError(CurrencyExchangeError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
|
|
|
super().__init__(f"{message}")
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidCurrencyError(CurrencyExchangeError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, currency):
|
|
|
|
super().__init__(f"Invalid currency: {currency} is not a supported currency.")
|
|
|
|
|
|
|
|
|
|
|
|
class PurchaseError(BaseError):
|
|
|
|
"""
|
|
|
|
Purchase process errors.
|
|
|
|
"""
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2018-07-24 18:03:43 +02:00
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class KeyFeeAboveMaxAllowedError(PurchaseError):
|
2019-12-03 16:55:06 +01:00
|
|
|
log_level = 50
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
|
|
|
super().__init__(f"{message}")
|
2018-07-24 18:03:43 +02:00
|
|
|
|