code: public function transaction(\Closure $closure)
      {
          if (!$this->isInitialized()) {
              $this->initialize();
          }
  
          try {
              $this->startTransaction();
  
              $result = $closure($this);
  
              if (!$result) {
                  return $this->rollbackTransaction();
              }
  
              return $this->commitTransaction();
          } catch (\Exception $e) {
              $this->rollbackTransaction();
              throw new HectorException('Transaction failed', 255, $e);
          }
      }
docs: @param \Closure $closure
  
  @throws \Exception
  
  @return bool