Show / Hide Table of Contents

Class ContractException

Represents an error with a contract query that passed the gateway node pre-check and was processed by the gossip node but did not succeed. It includes additional information returned by the hedera contract virtual machine. Transaction fees will have been spent.

Inheritance
object
Exception
ContractException
Implements
ISerializable
Inherited Members
Exception.GetBaseException()
Exception.GetType()
Exception.ToString()
Exception.Data
Exception.HelpLink
Exception.HResult
Exception.InnerException
Exception.Message
Exception.Source
Exception.StackTrace
Exception.TargetSite
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.ReferenceEquals(object, object)
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public sealed class ContractException : Exception, ISerializable
Remarks

Contract exceptions are generally permanent — they represent EVM-level failures (revert, out-of-gas, invalid opcode) that will produce the same result if retried with identical inputs.

Inspect CallResult for EVM-level details: the revert reason string (if the contract emitted one), gas consumption, and any events that fired before the revert. The Status property carries the Hedera-level response code (e.g. ContractRevertExecuted).

For InsufficientGas, increase the Gas property on your CallContractParams or QueryContractParams and retry. For other codes, review the contract's Solidity logic and the inputs that caused the revert.

When using QueryContractParams, you can suppress this exception by setting ThrowOnFail to false — the ContractCallResult is then returned directly so you can inspect the failure without a try/catch.

Properties

| Edit this page View Source

CallResult

The results returned from the failed call to the smart contract virtual machine.

Declaration
public ContractCallResult CallResult { get; }
Property Value
Type Description
ContractCallResult
| Edit this page View Source

RequiredFee

If the returned status is InsufficientTxFee this value will contain the transaction fee necessary to execute the transaction.

Declaration
public ulong RequiredFee { get; }
Property Value
Type Description
ulong
| Edit this page View Source

Status

The ResponseCode returned by the network prior to transaction request expiration.

Declaration
public ResponseCode Status { get; }
Property Value
Type Description
ResponseCode
| Edit this page View Source

TransactionId

The TransactionId ID generated by the library (or client code) identifying the request.

Declaration
public TransactionId TransactionId { get; }
Property Value
Type Description
TransactionId

Implements

ISerializable
  • Edit this page
  • View Source
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph