2020-02-08 00:25:06 +01:00
|
|
|
from .base import BaseError, claim_id
|
2018-08-04 23:19:10 +02:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class UserInputError(BaseError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
User input errors.
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class CommandError(UserInputError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
Errors preparing to execute commands.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class CommandDoesNotExistError(CommandError):
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.command = command
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"Command '{command}' does not exist.")
|
|
|
|
|
|
|
|
|
|
|
|
class CommandDeprecatedError(CommandError):
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.command = command
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"Command '{command}' is deprecated.")
|
|
|
|
|
|
|
|
|
|
|
|
class CommandInvalidArgumentError(CommandError):
|
2019-12-06 16:22:21 +01:00
|
|
|
|
|
|
|
def __init__(self, argument, command):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.argument = argument
|
|
|
|
self.command = command
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__(f"Invalid argument '{argument}' to command '{command}'.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class CommandTemporarilyUnavailableError(CommandError):
|
|
|
|
"""
|
|
|
|
Such as waiting for required components to start.
|
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.command = command
|
2019-11-19 19:57:14 +01:00
|
|
|
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-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, command):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.command = command
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"Command '{command}' is permanently unavailable.")
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class InputValueError(UserInputError, ValueError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
Invalid argument value provided to command.
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class GenericInputValueError(InputValueError):
|
2019-11-19 19:57:14 +01:00
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
def __init__(self, value, argument):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.value = value
|
|
|
|
self.argument = argument
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__(f"The value '{value}' for argument '{argument}' is not valid.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-13 16:44:41 +01:00
|
|
|
class InputValueIsNoneError(InputValueError):
|
|
|
|
|
|
|
|
def __init__(self, argument):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.argument = argument
|
2019-12-13 16:44:41 +01:00
|
|
|
super().__init__(f"None or null is not valid value for argument '{argument}'.")
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ConfigurationError(BaseError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
Configuration errors.
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ConfigWriteError(ConfigurationError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
When writing the default config fails on startup, such as due to permission issues.
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
def __init__(self, path):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.path = path
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__(f"Cannot write configuration file '{path}'.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ConfigReadError(ConfigurationError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
Can't open the config file user provided via command line args.
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
|
|
|
|
def __init__(self, path):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.path = path
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__(f"Cannot find provided configuration file '{path}'.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ConfigParseError(ConfigurationError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
Includes the syntax error / line number to help user fix it.
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
def __init__(self, path):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.path = path
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__(f"Failed to parse the configuration file '{path}'.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ConfigMissingError(ConfigurationError):
|
2019-11-19 19:57:14 +01:00
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
def __init__(self, path):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.path = path
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__(f"Configuration file '{path}' is missing setting that has no default / fallback.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ConfigInvalidError(ConfigurationError):
|
2019-11-19 19:57:14 +01:00
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
def __init__(self, path):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.path = path
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__(f"Configuration file '{path}' has setting with invalid value.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class NetworkError(BaseError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
**Networking**
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class NoInternetError(NetworkError):
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
def __init__(self):
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__("No internet connection.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class NoUPnPSupportError(NetworkError):
|
2019-11-19 19:57:14 +01:00
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Router does not support UPnP.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class WalletError(BaseError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
**Wallet Errors**
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class TransactionRejectedError(WalletError):
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Transaction rejected, unknown reason.")
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class TransactionFeeTooLowError(WalletError):
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Fee too low.")
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class TransactionInvalidSignatureError(WalletError):
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Invalid signature.")
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class InsufficientFundsError(WalletError):
|
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-06 16:22:21 +01:00
|
|
|
|
2019-11-19 20:29:04 +01:00
|
|
|
def __init__(self):
|
2019-12-31 21:30:13 +01:00
|
|
|
super().__init__("Not enough funds to cover this transaction.")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ChannelKeyNotFoundError(WalletError):
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Channel signing key not found.")
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ChannelKeyInvalidError(WalletError):
|
2019-11-19 19:57:14 +01:00
|
|
|
"""
|
|
|
|
For example, channel was updated but you don't have the updated key.
|
|
|
|
"""
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Channel signing key is out of date.")
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class DataDownloadError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Failed to download blob. *generic*")
|
2019-11-19 19:57:14 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ResolveError(WalletError):
|
|
|
|
|
2019-11-19 20:29:04 +01:00
|
|
|
def __init__(self, url):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.url = url
|
2019-11-19 20:29:04 +01:00
|
|
|
super().__init__(f"Failed to resolve '{url}'.")
|
2017-06-09 19:39:55 +02:00
|
|
|
|
2018-08-04 23:19:10 +02:00
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class ResolveTimeoutError(WalletError):
|
|
|
|
|
2019-11-19 20:29:04 +01:00
|
|
|
def __init__(self, url):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.url = url
|
2019-11-19 20:29:04 +01:00
|
|
|
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
|
|
|
|
2020-02-01 18:49:01 +01:00
|
|
|
class ResolveCensoredError(WalletError):
|
|
|
|
|
2021-07-20 23:25:37 +02:00
|
|
|
def __init__(self, url, censor_id):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.url = url
|
2021-07-21 00:48:17 +02:00
|
|
|
self.censor_id = censor_id
|
2021-07-20 23:25:37 +02:00
|
|
|
super().__init__(f"Resolve of '{url}' was censored by channel with claim id '{censor_id}'.")
|
2020-02-01 18:49:01 +01:00
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class KeyFeeAboveMaxAllowedError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, message):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.message = message
|
2019-12-06 16:22:21 +01:00
|
|
|
super().__init__(f"{message}")
|
|
|
|
|
|
|
|
|
2019-12-07 15:16:04 +01:00
|
|
|
class InvalidPasswordError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Password is invalid.")
|
|
|
|
|
|
|
|
|
2020-01-15 18:57:37 +01:00
|
|
|
class IncompatibleWalletServerError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, server, port):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.server = server
|
|
|
|
self.port = port
|
2020-01-15 18:57:37 +01:00
|
|
|
super().__init__(f"'{server}:{port}' has an incompatibly old version.")
|
|
|
|
|
|
|
|
|
2021-08-06 17:55:33 +02:00
|
|
|
class TooManyClaimSearchParametersError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, key, limit):
|
|
|
|
self.key = key
|
|
|
|
self.limit = limit
|
|
|
|
super().__init__(f"{key} cant be set for more than {limit} items.")
|
|
|
|
|
|
|
|
|
2020-02-21 16:05:46 +01:00
|
|
|
class ServerPaymentInvalidAddressError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, address):
|
|
|
|
self.address = address
|
|
|
|
super().__init__(f"Invalid address from wallet server: '{address}' - skipping payment round.")
|
|
|
|
|
|
|
|
|
|
|
|
class ServerPaymentWalletLockedError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__("Cannot spend funds with locked wallet, skipping payment round.")
|
|
|
|
|
|
|
|
|
|
|
|
class ServerPaymentFeeAboveMaxAllowedError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, daily_fee, max_fee):
|
|
|
|
self.daily_fee = daily_fee
|
|
|
|
self.max_fee = max_fee
|
2020-02-21 16:16:56 +01:00
|
|
|
super().__init__(f"Daily server fee of {daily_fee} exceeds maximum configured of {max_fee} LBC.")
|
2020-02-21 16:05:46 +01:00
|
|
|
|
|
|
|
|
2021-08-17 17:14:43 +02:00
|
|
|
class WalletNotLoadedError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, wallet_id):
|
|
|
|
self.wallet_id = wallet_id
|
|
|
|
super().__init__(f"Wallet {wallet_id} is not loaded.")
|
|
|
|
|
|
|
|
|
2021-08-17 18:17:45 +02:00
|
|
|
class WalletAlreadyLoadedError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, wallet_path):
|
|
|
|
self.wallet_path = wallet_path
|
|
|
|
super().__init__(f"Wallet {wallet_path} is already loaded.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletNotFoundError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, wallet_path):
|
|
|
|
self.wallet_path = wallet_path
|
|
|
|
super().__init__(f"Wallet not found at {wallet_path}.")
|
|
|
|
|
|
|
|
|
|
|
|
class WalletAlreadyExistsError(WalletError):
|
|
|
|
|
|
|
|
def __init__(self, wallet_path):
|
|
|
|
self.wallet_path = wallet_path
|
|
|
|
super().__init__(f"Wallet {wallet_path} already exists, use `wallet_add` to load it.")
|
|
|
|
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class BlobError(BaseError):
|
|
|
|
"""
|
|
|
|
**Blobs**
|
|
|
|
"""
|
2016-07-29 00:48:29 +02:00
|
|
|
|
2015-09-01 23:49:26 +02:00
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class BlobNotFoundError(BlobError):
|
2015-09-01 23:49:26 +02:00
|
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class BlobPermissionDeniedError(BlobError):
|
|
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class BlobTooBigError(BlobError):
|
|
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class BlobEmptyError(BlobError):
|
|
|
|
|
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
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class BlobFailedDecryptionError(BlobError):
|
2015-08-20 17:27:15 +02:00
|
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class CorruptBlobError(BlobError):
|
|
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class BlobFailedEncryptionError(BlobError):
|
2015-09-04 22:22:02 +02:00
|
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class DownloadCancelledError(BlobError):
|
2017-02-16 15:09:21 +01:00
|
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class DownloadSDTimeoutError(BlobError):
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, download):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.download = download
|
2019-11-19 19:57:14 +01:00
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class DownloadDataTimeoutError(BlobError):
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, download):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.download = download
|
2019-11-19 19:57:14 +01:00
|
|
|
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-12-06 16:22:21 +01:00
|
|
|
class InvalidStreamDescriptorError(BlobError):
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.message = message
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"{message}")
|
2017-07-20 00:15:07 +02:00
|
|
|
|
2018-07-24 18:03:43 +02:00
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class InvalidDataError(BlobError):
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.message = message
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"{message}")
|
|
|
|
|
|
|
|
|
2019-12-06 16:22:21 +01:00
|
|
|
class InvalidBlobHashError(BlobError):
|
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.message = message
|
2019-11-19 19:57:14 +01:00
|
|
|
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**
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class ComponentStartConditionNotMetError(ComponentError):
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, components):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.components = components
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"Unresolved dependencies for: {components}")
|
|
|
|
|
|
|
|
|
|
|
|
class ComponentsNotStartedError(ComponentError):
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.message = message
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"{message}")
|
|
|
|
|
|
|
|
|
|
|
|
class CurrencyExchangeError(BaseError):
|
|
|
|
"""
|
|
|
|
**Currency Exchange**
|
|
|
|
"""
|
|
|
|
|
2018-07-24 18:03:43 +02:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
class InvalidExchangeRateResponseError(CurrencyExchangeError):
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, source, reason):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.source = source
|
|
|
|
self.reason = reason
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"Failed to get exchange rate from {source}: {reason}")
|
|
|
|
|
|
|
|
|
|
|
|
class CurrencyConversionError(CurrencyExchangeError):
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, message):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.message = message
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"{message}")
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidCurrencyError(CurrencyExchangeError):
|
2019-12-06 16:22:21 +01:00
|
|
|
|
2019-11-19 19:57:14 +01:00
|
|
|
def __init__(self, currency):
|
2020-02-08 00:25:06 +01:00
|
|
|
self.currency = currency
|
2019-11-19 19:57:14 +01:00
|
|
|
super().__init__(f"Invalid currency: {currency} is not a supported currency.")
|