code: private Long runErrorHooks(EDBCommit commit, EDBException exception) throws EDBException {
          for (EDBErrorHook hook : errorHooks) {
              try {
                  EDBCommit newCommit = hook.onError(commit, exception);
                  if (newCommit != null) {
                      return commit(newCommit);
                  }
              } catch (ServiceUnavailableException e) {
                  // Ignore
              } catch (EDBException e) {
                  exception = e;
                  break;
              } catch (Exception e) {
                  logger.error("Error while performing EDBErrorHook", e);
              }
          }
          throw exception;
      }
docs: Runs all registered error hooks on the EDBCommit object. Logs exceptions which occurs in the hooks, except for
  ServiceUnavailableExceptions and EDBExceptions. If an EDBException occurs, the function overrides the cause of
  the error with the new Exception. If an error hook returns a new EDBCommit, the EDB tries to persist this commit
  instead.