ape.exceptions
- exception ape.exceptions.APINotImplementedError
Bases:
ApeException,NotImplementedErrorAn error raised when an API class does not implement an abstract method.
- exception ape.exceptions.Abort(message: str | None = None)
Bases:
ClickExceptionA wrapper around a CLI exception. When you raise this error, the error is nicely printed to the terminal. This is useful for all user-facing errors.
- show(file=None)
Override default
showto print CLI errors in red text.
- exception ape.exceptions.AccountsError
Bases:
ApeExceptionRaised when a problem occurs when using accounts.
- exception ape.exceptions.AliasAlreadyInUseError(alias: str)
Bases:
AccountsErrorRaised when attempting to add an account using an alias that already maps to another account.
- exception ape.exceptions.ApeAttributeError(msg: str, base_err: Exception | None = None)
Bases:
ProjectError,AttributeErrorRaised when trying to access items via
.access.
- exception ape.exceptions.ApeException
Bases:
ExceptionAn exception raised by ape.
- exception ape.exceptions.ApeIndexError
Bases:
ApeException,IndexErrorAn exception that is also an IndexError. Useful for nicely displaying IndexErrors.
- exception ape.exceptions.ArgumentsLengthError(arguments_length: int, inputs: MethodABI | ConstructorABI | int | list | None = None, **kwargs)
Bases:
ContractDataErrorRaised when calling a contract method with the wrong number of arguments.
- exception ape.exceptions.BlockNotFoundError(block_id: BlockID, reason: str | None = None)
Bases:
ProviderErrorRaised when unable to find a block.
- exception ape.exceptions.ChainError
Bases:
ApeExceptionRaised when problems occur in the
ChainManager.
- exception ape.exceptions.CompilerError
Bases:
ApeExceptionRaised when unable to compile.
- exception ape.exceptions.ConfigError
Bases:
ApeExceptionRaised when a problem occurs from the configuration file.
- exception ape.exceptions.ContractDataError
Bases:
ApeExceptionRaised when issues occur with local contract. NOTE: This error has nothing to do with on-chain contract logic errors; it is more about ABI-related issues and alike.
- exception ape.exceptions.ContractLogicError(revert_message: str | None = None, txn: TransactionAPI | ReceiptAPI | None = None, trace: TraceAPI | Callable[[], TraceAPI | None] | None = None, contract_address: AddressType | None = None, source_traceback: SourceTraceback | Callable[[], SourceTraceback | None] | None = None, base_err: Exception | None = None, project: ProjectManager | None = None, set_ape_traceback: bool = True)
Bases:
VirtualMachineErrorRaised when there is a contract-defined revert, such as from an assert/require statement.
- property dev_message: str | None
The dev-string message of the exception.
- Raises:
ValueError – When unable to get dev message.
- 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.ContractNotFoundError(address: AddressType, has_explorer: bool, network_choice: str)
Bases:
ChainErrorRaised when a contract is not found at an address.
- exception ape.exceptions.ConversionError
Bases:
ApeExceptionRaised when unable to convert a value.
- exception ape.exceptions.CustomError(abi: ErrorABI, inputs: dict[str, Any], txn: TransactionAPI | ReceiptAPI | None = None, trace: TraceAPI | Callable[[], TraceAPI | None] | None = None, contract_address: AddressType | None = None, base_err: Exception | None = None, source_traceback: SourceTraceback | Callable[[], SourceTraceback | None] | None = None)
Bases:
ContractLogicErrorAn error defined in a smart contract.
- property name: str
The name of the error.
- exception ape.exceptions.DecodingError(message: str | None = None)
Bases:
ContractDataErrorRaised when issues occur while decoding data from a contract call, transaction, or event.
- exception ape.exceptions.EcosystemNotFoundError(ecosystem: str, options: Collection[str] | None = None)
Bases:
NetworkErrorRaised when the ecosystem with the given name was not found.
- exception ape.exceptions.MethodNonPayableError
Bases:
ContractDataErrorRaises when sending funds to a non-payable method
- exception ape.exceptions.MissingDeploymentBytecodeError(contract_type: ContractType)
Bases:
ContractDataErrorRaised when trying to deploy an interface or empty data.
- exception ape.exceptions.NetworkError
Bases:
ApeExceptionRaised when a problem occurs when using blockchain networks.
- exception ape.exceptions.NetworkMismatchError(chain_id: int, network: NetworkAPI)
Bases:
ProviderErrorRaised when connecting a provider to the wrong network.
- exception ape.exceptions.NetworkNotFoundError(network: str, ecosystem: str | None = None, options: Collection[str] | None = None)
Bases:
NetworkErrorRaised when the network with the given name was not found.
- exception ape.exceptions.OutOfGasError(code: int | None = None, txn: TransactionAPI | ReceiptAPI | None = None, base_err: Exception | None = None, set_ape_traceback: bool = False)
Bases:
VirtualMachineErrorRaised when detecting a transaction failed because it ran out of gas.
- exception ape.exceptions.PluginInstallError
Bases:
ApeExceptionAn error to use when installing a plugin fails.
- exception ape.exceptions.PluginVersionError(operation: str, reason: str | None = None, resolution: str | None = None)
Bases:
PluginInstallErrorAn error related to specified plugin version.
- exception ape.exceptions.ProjectError
Bases:
ApeExceptionRaised when problems occur in a project.
- exception ape.exceptions.ProviderError
Bases:
ApeExceptionRaised when a problem occurs when using providers.
- exception ape.exceptions.ProviderNotConnectedError
Bases:
ProviderErrorRaised when not connected to a provider.
- exception ape.exceptions.ProviderNotFoundError(provider: str, network: str | None = None, ecosystem: str | None = None, options: Collection[str] | None = None)
Bases:
NetworkErrorRaised when the provider with the given name was not found.
- exception ape.exceptions.QueryEngineError
Bases:
ApeExceptionRaised 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(message: str, transaction: TransactionAPI | None = None)
Bases:
AccountsErrorRaised when there are issues with signing.
- exception ape.exceptions.SubprocessError
Bases:
ApeExceptionAn 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:
SubprocessErrorA 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 | ReceiptAPI | None = None, trace: TraceAPI | Callable[[], TraceAPI | None] | None = None, contract_address: AddressType | None = None, source_traceback: SourceTraceback | Callable[[], SourceTraceback | None] | None = None, project: ProjectManager | None = None, set_ape_traceback: bool = False)
Bases:
ApeExceptionRaised when issues occur related to transactions.
- exception ape.exceptions.TransactionNotFoundError(transaction_hash: str | None = None, error_message: str | None = None)
Bases:
ProviderErrorRaised when unable to find a transaction.
- exception ape.exceptions.UnknownSnapshotError(snapshot_id: SnapshotID)
Bases:
ChainErrorRaised when given an unknown snapshot ID.
- exception ape.exceptions.UnknownVersionError(version: str, name: str)
Bases:
ProjectErrorRaised when trying to install an unknown version of a package.
- exception ape.exceptions.VirtualMachineError(message: str | None = None, base_err: Exception | None = None, code: int | None = None, txn: TransactionAPI | ReceiptAPI | None = None, trace: TraceAPI | Callable[[], TraceAPI | None] | None = None, contract_address: AddressType | None = None, source_traceback: SourceTraceback | Callable[[], SourceTraceback | None] | None = None, project: ProjectManager | None = None, set_ape_traceback: bool = False)
Bases:
TransactionErrorRaised when a transaction error occurs in a virtual machine.
- ape.exceptions.handle_ape_exception(err: ApeException, base_paths: Iterable[Path | str]) bool
Handle a transaction error by showing relevant stack frames, including custom contract frames added to the exception. This method must be called within an
exceptblock or with an exception on the exc-stack.- Parameters:
err (
TransactionError) – The transaction error being handled.base_paths (Optional[Iterable[Union[Path, str]]]) – Optionally include additional source-path prefixes to use when finding relevant frames.
- Returns:
Trueif outputted something.- Return type:
bool