Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 56 additions & 13 deletions bittensor/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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."""

Expand Down Expand Up @@ -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."""
Loading