diff --git a/bittensor/core/errors.py b/bittensor/core/errors.py index 19e748103f..438faab0b4 100644 --- a/bittensor/core/errors.py +++ b/bittensor/core/errors.py @@ -10,11 +10,54 @@ if TYPE_CHECKING: from bittensor.core.synapse import Synapse -# redundant aliases -SubstrateRequestException = SubstrateRequestException -StorageFunctionNotFound = StorageFunctionNotFound -BlockNotFound = BlockNotFound -ExtrinsicNotFound = ExtrinsicNotFound +__all__ = [ + "BalanceTypeError", + "BalanceUnitMismatchError", + "BlacklistedException", + "BlockNotFound", + "ChainConnectionError", + "ChainError", + "ChainQueryError", + "ChainTransactionError", + "DelegateTakeTooHigh", + "DelegateTakeTooLow", + "DelegateTxRateLimitExceeded", + "DuplicateChild", + "ExtrinsicNotFound", + "HotKeyAccountNotExists", + "IdentityError", + "InternalServerError", + "InvalidChild", + "InvalidRequestNameError", + "MaxAttemptsException", + "MaxSuccessException", + "MetadataError", + "NominationError", + "NonAssociatedColdKey", + "NotDelegateError", + "NotEnoughStakeToSetChildkeys", + "NotRegisteredError", + "NotVerifiedException", + "PostProcessException", + "PriorityException", + "ProportionOverflow", + "RegistrationError", + "RegistrationNotPermittedOnRootSubnet", + "RunException", + "StakeError", + "StorageFunctionNotFound", + "SubnetNotExists", + "SubstrateRequestException", + "SynapseDendriteNoneException", + "SynapseException", + "SynapseParsingError", + "TakeError", + "TooManyChildren", + "TransferError", + "TxRateLimitExceeded", + "UnknownSynapseError", + "UnstakeError", +] class _ChainErrorMeta(type): @@ -40,6 +83,14 @@ class MaxAttemptsException(Exception): """Raised when the POW Solver has reached the max number of attempts.""" +class BalanceTypeError(Exception): + """Raised when a Balance object receives an invalid type.""" + + +class BalanceUnitMismatchError(Exception): + """Raised when Balance objects with different units are used in operations.""" + + class ChainError(SubstrateRequestException, metaclass=_ChainErrorMeta): """Base error for any chain related errors.""" @@ -212,11 +263,3 @@ def __init__( ): self.message = message super().__init__(self.message, synapse) - - -class BalanceUnitMismatchError(Exception): - """Raised when operations is attempted between Balance objects with different units (netuid).""" - - -class BalanceTypeError(TypeError): - """Raised when an unsupported type is used instead of Balance amount."""