Class PrecheckException
Represents the condition where a submitted transaction failed the pre-check validation by the network gateway node.
Implements
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public sealed class PrecheckException : Exception, ISerializable
Remarks
The gateway node answered the last attempt with a refusal. Whether that proves the transaction did not execute depends on Status.
Codes about the transaction itself are definite: for example InvalidSignature, InsufficientPayerBalance, InvalidAccountId, TokenNotAssociatedToAccount and InvalidTransactionBody. Nothing executed and no fee was charged; fix the request before sending it again.
Codes about the node, the network or the connection prove
nothing: Unknown (no answer could be
had, for example a refused connection), RpcError,
Busy,
PlatformTransactionNotCreated,
PlatformNotActive,
DuplicateTransaction (a transaction with this
id was already accepted) and TransactionExpired.
The SDK may have sent the same transaction earlier in the call, and an
answer can be lost after the network accepted it. Treat the outcome as
unknown: do not resubmit, and settle it on a mirror node by
TransactionId (see ConsensusException). Code
that moves value is safest treating every PrecheckException this
way.
The SDK itself retries Busy and InvalidTransactionStart within RetryCount, so seeing either here means those retries ran out.
If Status is
InsufficientTxFee, the
RequiredFee property contains the minimum fee (in tinybars)
the gateway expects — increase IConsensusContext.FeeLimit to at
least this amount and retry with the same
TransactionId, so the network's
duplicate check stops a second execution should an earlier attempt in
the call have gone through.
Queries: a paid query's payment can be charged even when the answer carries a refusal code. Depending on the network version, the node may submit the payment before checking or answering the query, so "no fee was charged" holds for a query only when the payment itself was refused, as with InsufficientTxFee.
Constructors
| Edit this page View SourcePrecheckException(string, TransactionId, ResponseCode, ulong)
Exception constructor.
Declaration
public PrecheckException(string message, TransactionId transaction, ResponseCode code, ulong requiredFee)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | A message describing the nature of the problem. |
| TransactionId | transaction | The transaction ID corresponding to the request that failed. |
| ResponseCode | code | The status code returned by the gateway node. |
| ulong | requiredFee | The cost value returned for insufficient transaction fee errors. |
PrecheckException(string, TransactionId, ResponseCode, ulong, Exception)
Exception constructor.
Declaration
public PrecheckException(string message, TransactionId transaction, ResponseCode code, ulong requiredFee, Exception innerException)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | A message describing the nature of the problem. |
| TransactionId | transaction | The transaction ID corresponding to the request that failed. |
| ResponseCode | code | The status code returned by the gateway node. |
| ulong | requiredFee | The cost value returned for insufficient transaction fee errors. |
| Exception | innerException | Inner exception causing this error, typically reserved for fundamental GRPC pipeline exceptions. |
Properties
| Edit this page View SourceRequiredFee
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 status code returned by the gateway node.
Declaration
public ResponseCode Status { get; }
Property Value
| Type | Description |
|---|---|
| ResponseCode |
TransactionId
The transaction ID corresponding to the request that failed.
Declaration
public TransactionId TransactionId { get; }
Property Value
| Type | Description |
|---|---|
| TransactionId |