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.
Implements
Inherited Members
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 SourceCallResult
The results returned from the failed call to the smart contract virtual machine.
Declaration
public ContractCallResult CallResult { get; }
Property Value
| Type | Description |
|---|---|
| ContractCallResult |
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 |
Status
The ResponseCode returned by the network prior to transaction request expiration.
Declaration
public ResponseCode Status { get; }
Property Value
| Type | Description |
|---|---|
| ResponseCode |
TransactionId
The TransactionId ID generated by the library (or client code) identifying the request.
Declaration
public TransactionId TransactionId { get; }
Property Value
| Type | Description |
|---|---|
| TransactionId |