ape.exceptions

exception ape.exceptions.APINotImplementedError

Bases: ApeException, NotImplementedError

An error raised when an API class does not implement an abstract method.

exception ape.exceptions.AccountsError

Bases: ApeException

Raised when a problem occurs when using accounts.

exception ape.exceptions.AliasAlreadyInUseError(alias: str)

Bases: AccountsError

Raised when attempting to add an account using an alias that already maps to another account.

exception ape.exceptions.ApeException

Bases: Exception

An exception raised by ape.

exception ape.exceptions.ArgumentsLengthError(arguments_length: int, inputs_length: int | None = None)

Bases: ContractError

Raised when calling a contract method with the wrong number of arguments.

exception ape.exceptions.BlockNotFoundError(block_id: BlockID)

Bases: ProviderError

Raised when unable to find a block.

exception ape.exceptions.ChainError

Bases: ApeException

Raised when problems occur in the ChainManager.

exception ape.exceptions.CompilerError

Bases: ApeException

Raised when unable to compile.

exception ape.exceptions.ConfigError

Bases: ApeException

Raised when a problem occurs from the configuration file.

exception ape.exceptions.ContractError

Bases: ApeException

Raised when issues occur with contracts.

exception ape.exceptions.ContractLogicError(revert_message: str | None = None, txn: TransactionAPI | None = None)

Bases: VirtualMachineError

Raised when there is a contract-defined revert, such as from an assert/require statement.

classmethod from_error(err: Exception)

Creates this class from the error message of the given error.

This should be overridden whenever possible to handle provider-specific use-cases for raising this error.

exception ape.exceptions.ConversionError

Bases: ApeException

Raised when unable to convert a value.

exception ape.exceptions.DecodingError(message: str | None = None)

Bases: ContractError

Raised when issues occur while decoding data from a contract call, transaction, or event.

exception ape.exceptions.NetworkError

Bases: ApeException

Raised when a problem occurs when using blockchain networks.

exception ape.exceptions.NetworkMismatchError(chain_id: int, network: NetworkAPI)

Bases: ProviderError

Raised when connecting a provider to the wrong network.

exception ape.exceptions.NetworkNotFoundError(network: str)

Bases: NetworkError

Raised when the network with the given name was not found.

exception ape.exceptions.OutOfGasError(code: int | None = None, txn: TransactionAPI | None = None)

Bases: VirtualMachineError

Raised when detecting a transaction failed because it ran out of gas.

exception ape.exceptions.ProjectError

Bases: ApeException

Raised when problems occur in a project.

exception ape.exceptions.ProviderError

Bases: ApeException

Raised when a problem occurs when using providers.

exception ape.exceptions.ProviderNotConnectedError

Bases: ProviderError

Raised when not connected to a provider.

exception ape.exceptions.QueryEngineError

Bases: ApeException

Raised when issues occur in a query engine.

exception ape.exceptions.RPCTimeoutError(provider: SubprocessProvider, seconds: int | None = None, exception: Exception | None = None, *args, **kwargs)

Bases: SubprocessTimeoutError

exception ape.exceptions.SignatureError

Bases: AccountsError

Raised when there are issues with signing.

exception ape.exceptions.SubprocessError

Bases: ApeException

An error raised whilst managing a subprocess.

exception ape.exceptions.SubprocessTimeoutError(provider: SubprocessProvider, message: str | None = None, seconds: int | None = None, exception: Exception | None = None, *args, **kwargs)

Bases: SubprocessError

A context-manager exception that raises if its operations exceed the given timeout seconds.

This implementation was inspired from py-geth.

exception ape.exceptions.TransactionError(message: str | None = None, base_err: Exception | None = None, code: int | None = None, txn: TransactionAPI | None = None)

Bases: ContractError

Raised when issues occur related to transactions.

exception ape.exceptions.TransactionNotFoundError(txn_hash: str)

Bases: ProviderError

Raised when unable to find a transaction.

exception ape.exceptions.UnknownSnapshotError(snapshot_id: SnapshotID)

Bases: ChainError

Raised when given an unknown snapshot ID.

exception ape.exceptions.VirtualMachineError(message: str | None = None, base_err: Exception | None = None, code: int | None = None, txn: TransactionAPI | None = None)

Bases: TransactionError

Raised when a transaction error occurs in a virtual machine.