Exception ApiException (2.68.2)

publicclassApiExceptionextendsRuntimeException

Represents an exception thrown during an RPC call.

Constructors

ApiException(String message, Throwable cause, StatusCode statusCode, boolean retryable)

publicApiException(Stringmessage,Throwablecause,StatusCodestatusCode,booleanretryable)
Parameters
NameDescription
messageString
causeThrowable
statusCodeStatusCode
retryableboolean

ApiException(Throwable cause, StatusCode statusCode, boolean retryable)

publicApiException(Throwablecause,StatusCodestatusCode,booleanretryable)
Parameters
NameDescription
causeThrowable
statusCodeStatusCode
retryableboolean

ApiException(Throwable cause, StatusCode statusCode, boolean retryable, ErrorDetails errorDetails)

publicApiException(Throwablecause,StatusCodestatusCode,booleanretryable,ErrorDetailserrorDetails)
Parameters
NameDescription
causeThrowable
statusCodeStatusCode
retryableboolean
errorDetailsErrorDetails

Methods

getDomain()

publicStringgetDomain()

Returns the logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. e.g. googleapis.com

Returns
TypeDescription
String

getErrorDetails()

publicErrorDetailsgetErrorDetails()

Returns all standard error messages that server sends.

Returns
TypeDescription
ErrorDetails

getMetadata()

publicMap<String,String>getMetadata()

Returns additional structured details about this exception.

Returns
TypeDescription
Map<String,String>

getReason()

publicStringgetReason()

Returns the reason of the exception. This is a constant value that identifies the proximate cause of the error. e.g. SERVICE_DISABLED

Returns
TypeDescription
String

getStatusCode()

publicStatusCodegetStatusCode()

Returns the status code of the underlying exception.

Returns
TypeDescription
StatusCode

isRetryable()

publicbooleanisRetryable()

Returns whether the failed request can be retried.

Returns
TypeDescription
boolean

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.