Package com.google.cloud
Class BaseServiceException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.google.cloud.BaseServiceException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BaseGrpcServiceException
,BaseHttpServiceException
public class BaseServiceException extends RuntimeException
Base class for all service exceptions.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseServiceException.Error
static class
BaseServiceException.ExceptionData
-
Field Summary
Fields Modifier and Type Field Description static int
UNKNOWN_CODE
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseServiceException(BaseServiceException.ExceptionData exceptionData)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
getCode()
Returns the code associated with this exception.String
getDebugInfo()
String
getLocation()
Returns the service location where the error causing the exception occurred.String
getReason()
Returns the reason that caused the exception.int
hashCode()
boolean
isRetryable()
Returnstrue
when it is safe to retry the operation that caused this exception.static boolean
isRetryable(boolean idempotent, IOException exception)
static boolean
isRetryable(Integer code, String reason, boolean idempotent, Set<BaseServiceException.Error> retryableErrors)
static void
translate(RetryHelper.RetryHelperException ex)
static void
translate(ExecutionException ex)
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
UNKNOWN_CODE
public static final int UNKNOWN_CODE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BaseServiceException
@InternalApi("This class should only be extended within google-cloud-java") protected BaseServiceException(BaseServiceException.ExceptionData exceptionData)
-
-
Method Detail
-
isRetryable
@InternalApi public static boolean isRetryable(Integer code, String reason, boolean idempotent, Set<BaseServiceException.Error> retryableErrors)
-
isRetryable
@InternalApi public static boolean isRetryable(boolean idempotent, IOException exception)
-
translate
@InternalApi public static void translate(RetryHelper.RetryHelperException ex)
-
translate
@InternalApi public static void translate(ExecutionException ex)
-
getCode
public int getCode()
Returns the code associated with this exception.
-
getReason
public String getReason()
Returns the reason that caused the exception.
-
isRetryable
public boolean isRetryable()
Returnstrue
when it is safe to retry the operation that caused this exception.
-
getLocation
public String getLocation()
Returns the service location where the error causing the exception occurred. Returnsnull
if not available.
-
getDebugInfo
@InternalApi public String getDebugInfo()
-
-