code: public <T> T doInTransaction(final TxConfig config,
                                   final TxAction<T> action) {
  
          T res = null;
          if (transactionManager.isTransactionActive()) {
              // execution inside of other transaction
              try {
                  res = action.execute();
              } catch (Throwable th) {
                  throwRuntime(th);
              }
          } else {
              try {
                  transactionManager.begin(config);
                  res = action.execute();
                  transactionManager.end();
  
              } catch (Throwable th) {
                  // transaction may be not active if exception happened during commit and
                  // tm already performed rollback action
                  if (transactionManager.isTransactionActive()) {
                      // calling once for nested transactions (or in case it was done manually
                      transactionManager.rollback(resolveErrorToAnalyze(th));
                  }
                  throwRuntime(th);
              }
          }
          return res;
      }
docs: Error is propagated if runtime or rethrown as runtime exception.
  
  @param config transaction config (ignored in case of ongoing transaction)
  @param action action to execute within transaction (new or ongoing)
  @param <T>    return value type
  @return value produced by action