code: public void transact(final DbCode code) {
      if (io.vertx.core.Context.isOnEventLoopThread()) {
        throw new DatabaseException("Do not call transact() from event loop threads; use transactAsync() instead");
      }
  
      boolean complete = false;
      try {
        code.run(this);
        complete = true;
      } catch (ThreadDeath | DatabaseException t) {
        throw t;
      } catch (Throwable t) {
        throw new DatabaseException("Error during transaction", t);
      } finally {
        if (!complete) {
          rollbackAndClose();
        } else {
          commitAndClose();
        }
      }
    }
docs: Execute a transaction on the current thread, with default semantics (commit if
  the code completes successfully, or rollback if it throws an error). Note you
  will get a DatabaseException if you try to call this from the event loop thread.
  If the provided code block throws anything, it will be wrapped into a DatabaseException
  unless it was a ThreadDeath or was already a DatabaseException.