# Exception CheckedApiException (1.16.5)

1.16.5 (latest) 1.16.2 1.15.21 1.14.8 1.13.8 1.12.22 1.11.2 1.10.0 1.9.4 1.8.0 1.7.1 1.6.3 1.5.5 1.4.12

    public class CheckedApiException extends Exception

A wrapper around an ApiException that is a checked exception to help ensure correctness of
internal classes as well as ease construction of ApiExceptions. Should not be exposed in end-user
interfaces.

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-) [Throwable.addSuppressed(Throwable)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#addSuppressed-java.lang.Throwable-) [Throwable.fillInStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#fillInStackTrace--) [Throwable.getCause()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getCause--) [Throwable.getLocalizedMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getLocalizedMessage--) [Throwable.getMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getMessage--) [Throwable.getStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getStackTrace--) [Throwable.getSuppressed()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getSuppressed--) [Throwable.initCause(Throwable)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#initCause-java.lang.Throwable-) [Throwable.printStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace--) [Throwable.printStackTrace(PrintStream)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintStream-) [Throwable.printStackTrace(PrintWriter)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintWriter-) [Throwable.setStackTrace(StackTraceElement\[\])](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#setStackTrace-java.lang.StackTraceElement[]-) [Throwable.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#toString--)

## Static Methods

### fromCode(StatusCode.Code code)

    public static StatusCode fromCode(StatusCode.Code code)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `code` | `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.StatusCode.Code.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.StatusCode.html` |   |

## Constructors

### CheckedApiException(ApiException underlying)

    public CheckedApiException(ApiException underlying)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `underlying` | `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.ApiException.html` |

### CheckedApiException(StatusCode.Code code)

    public CheckedApiException(StatusCode.Code code)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `code` | `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.StatusCode.Code.html` |

### CheckedApiException(String message, StatusCode.Code code)

    public CheckedApiException(String message, StatusCode.Code code)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `code` | `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.StatusCode.Code.html` |

### CheckedApiException(String message, Throwable cause, StatusCode.Code code)

    public CheckedApiException(String message, Throwable cause, StatusCode.Code code)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `message` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `cause` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html` |
| `code` | `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.StatusCode.Code.html` |

### CheckedApiException(Throwable cause, StatusCode.Code code)

    public CheckedApiException(Throwable cause, StatusCode.Code code)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `cause` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html` |
| `code` | `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.StatusCode.Code.html` |

## Fields

### underlying

    public final ApiException underlying

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.ApiException.html` |   |

## Methods

### code()

    public StatusCode.Code code()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.StatusCode.Code.html` |   |