From 21f78ee3690d3ca01653e529acdee202dfe1cb68 Mon Sep 17 00:00:00 2001 From: Chanseok Oh Date: Fri, 12 Nov 2021 17:46:46 -0500 Subject: [PATCH] Pass error message when creating exception --- .../java/com/google/api/gax/rpc/ApiExceptionFactory.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gax/src/main/java/com/google/api/gax/rpc/ApiExceptionFactory.java b/gax/src/main/java/com/google/api/gax/rpc/ApiExceptionFactory.java index d1b787e851..9820b751e8 100644 --- a/gax/src/main/java/com/google/api/gax/rpc/ApiExceptionFactory.java +++ b/gax/src/main/java/com/google/api/gax/rpc/ApiExceptionFactory.java @@ -43,8 +43,6 @@ public static ApiException createException( return new CancelledException(cause, statusCode, retryable); case NOT_FOUND: return new NotFoundException(cause, statusCode, retryable); - case UNKNOWN: - return new UnknownException(cause, statusCode, retryable); case INVALID_ARGUMENT: return new InvalidArgumentException(cause, statusCode, retryable); case DEADLINE_EXCEEDED: @@ -72,6 +70,7 @@ public static ApiException createException( case UNAUTHENTICATED: return new UnauthenticatedException(cause, statusCode, retryable); + case UNKNOWN: // Fall through. default: return new UnknownException(cause, statusCode, retryable); } @@ -84,8 +83,6 @@ public static ApiException createException( return new CancelledException(message, cause, statusCode, retryable); case NOT_FOUND: return new NotFoundException(message, cause, statusCode, retryable); - case UNKNOWN: - return new UnknownException(message, cause, statusCode, retryable); case INVALID_ARGUMENT: return new InvalidArgumentException(message, cause, statusCode, retryable); case DEADLINE_EXCEEDED: @@ -113,8 +110,9 @@ public static ApiException createException( case UNAUTHENTICATED: return new UnauthenticatedException(message, cause, statusCode, retryable); + case UNKNOWN: // Fall through. default: - return new UnknownException(cause, statusCode, retryable); + return new UnknownException(message, cause, statusCode, retryable); } } }