io.vertx.ext.consul

## Class TxnError

- java.lang.Object
- - io.vertx.ext.consul.TxnError

-     public class TxnError
      extends Object

  Holds information describing which operations failed if the transaction was rolled back.
  Author:
    Ruslan Sennov

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TxnError()` Default constructor
    `TxnError(JsonObject json)` Constructor from JSON

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getOpIndex()` Get the index of the failed operation in the transaction
    `String` | `getWhat()` Get error message about why that operation failed.
    `TxnError` | `setOpIndex(int opIndex)` Set the index of the failed operation in the transaction
    `TxnError` | `setWhat(String what)` Set error message about why that operation failed.
    `JsonObject` | `toJson()` Convert to JSON

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TxnError

          public TxnError()

      Default constructor

    - #### TxnError

          public TxnError(JsonObject json)

      Constructor from JSON
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

      Convert to JSON
      Returns:
        the JSON

    - #### getOpIndex

          public int getOpIndex()

      Get the index of the failed operation in the transaction
      Returns:
        the index of the failed operation in the transaction

    - #### getWhat

          public String getWhat()

      Get error message about why that operation failed.
      Returns:
        error message about why that operation failed.

    - #### setOpIndex

          public TxnError setOpIndex(int opIndex)

      Set the index of the failed operation in the transaction
      Parameters:
        `opIndex` - the index of the failed operation in the transaction
      Returns:
        reference to this, for fluency

    - #### setWhat

          public TxnError setWhat(String what)

      Set error message about why that operation failed.
      Parameters:
        `what` - error message about why that operation failed.
      Returns:
        reference to this, for fluency

Copyright © 2025 Eclipse. All rights reserved.