In https://quarkus.io/guides/reactive-sql-clients page we have code snippet to execute query changes using transaction :
SqlClientHelper.inTransactionUni(client, tx -> tx
.preparedQuery("INSERT INTO person (firstname,lastname) VALUES ($1,$2) RETURNING id").execute(Tuple.of(person.getFirstName(), person.getLastName()))
.onItem().transformToUni(id -> tx.preparedQuery("INSERT INTO addr (person_id,addrline1) VALUES ($1,$2)")
.execute(Tuple.of(id.iterator().next().getLong("id"), person.getLastName()))).onItem().ignore().andContinueWithNull());
so here SqlClientHelper will begin the transaction,commit and rollback if any failure but is there any way to find out the root cause of the failure and print it in logs ? In the documentation its not mentioned how we can do that.
You can use Mutiny's onFailure
to get the exception class and act on it. See this for more details.