Show / Hide Table of Contents

Class TransactionFailedException

A transaction was submitted and did not succeed.

Inheritance
object
Exception
RippleException
TransactionFailedException
Namespace: Xrpl.Client.Exceptions
Assembly: Xrpl.dll
Syntax
public class TransactionFailedException : RippleException
Remarks

The result code decides what a caller should do next, and the classes differ completely: tem means the request is malformed and must be fixed before it is sent again, tec means it was applied to a ledger and the fee was taken, ter means it may work later. Telling them apart used to mean reading the exception's message, which works until the first transaction whose message contains the substring somewhere else.

This derives from RippleException and keeps the message it always had, so a catch (RippleException) and anything matching on the text carry on unchanged. What is new is beside the message rather than inside it.

Constructors

| Edit this page View Source

TransactionFailedException(string, string, string, bool)

Declaration
public TransactionFailedException(string message, string engineResult, string hash, bool reachedLedger)
Parameters
Type Name Description
string message

The message this exception has always carried, unchanged.

string engineResult

The node's result code.

string hash

The transaction's hash.

bool reachedLedger

Whether the transaction was applied, when the code alone does not tell.

| Edit this page View Source

TransactionFailedException(string, string, string, TransactionSummary)

Declaration
public TransactionFailedException(string message, string engineResult, string hash, TransactionSummary result = null)
Parameters
Type Name Description
string message

The message this exception has always carried, unchanged.

string engineResult

The node's result code.

string hash

The transaction's hash.

TransactionSummary result

The validated transaction, or null if there is none.

Properties

| Edit this page View Source

EngineResult

The result code, as the node reported it - tecINSUFFICIENT_PAYMENT, temBAD_FEE and so on.

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

Hash

The transaction's hash.

Declaration
public string Hash { get; }
Property Value
Type Description
string
Remarks

Worth having even when the transaction never reached a ledger, but it is the ReachedLedger case where it matters: there is something to look up, and showing it is usually the first thing anyone wants to do after a refusal.

| Edit this page View Source

ReachedLedger

Whether the transaction was applied to a ledger - the fee taken, the transaction there to be looked up.

Declaration
public bool ReachedLedger { get; }
Property Value
Type Description
bool
Remarks

The difference is not a detail: applied means the fee is gone and there is something to show, while a refusal before that costs nothing and leaves nothing. The two arrive as the same kind of failure and are not the same event.

Read from the result code, so it holds for an exception built from a code alone: a tec means applied whether or not Result is here. Reliable submission reports a tec once validated, with its metadata, and the hash is present in every case - the hash is what an explorer needs. The exception is a tec refused under fail_hard, which rippled discards without applying it or taking the fee; that one is reported with this false.

| Edit this page View Source

Result

The validated transaction, metadata included - or null when there is none to hand back yet.

Declaration
public TransactionSummary Result { get; }
Property Value
Type Description
TransactionSummary
Remarks

Absent for a failure the node refused before a ledger. A tec is reported once it is validated, so it carries one. Use ReachedLedger to tell whether the fee was taken; Hash is there in every case.

Extension Methods

XrplErrorClassifier.Classify(Exception)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX