public static R2dbcException createR2dbcException()

in cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/util/SpannerExceptionUtil.java [67:84]


  public static R2dbcException createR2dbcException(Throwable baseException) {
    if (baseException == null) {
      return new R2dbcNonTransientResourceException();
    } else if (!(baseException instanceof StatusRuntimeException)) {
      return new R2dbcNonTransientResourceException(baseException.getMessage(), baseException);
    }

    StatusRuntimeException statusRuntimeException = (StatusRuntimeException) baseException;
    int errorCode = statusRuntimeException.getStatus().getCode().value();

    if (isRetryable(statusRuntimeException)) {
      return new R2dbcTransientResourceException(
          baseException.getMessage(), null, errorCode, baseException);
    } else {
      return createR2dbcException(
          errorCode, baseException.getMessage(), baseException);
    }
  }