# SessionException

# SessionException

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/com/google/ambient/crossdevice/sessions/SessionException "View this page in Kotlin")\|Java

<br />

```
@RequiresApi(value = 26) public final class SessionException extends CrossDeviceException
```

<br />

|---|---|---|---|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object)                                                                                                ||||||
| ↳ | [kotlin.Throwable](https://developer.android.com/reference/kotlin/Throwable)                                                                                             |||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception)                                                                                    ||||
|   |   | ↳ | [java.lang.RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException)                                                                   |||
|   |   |   | ↳ | [com.google.ambient.crossdevice.CrossDeviceException](https://developer.android.com/reference/com/google/ambient/crossdevice/CrossDeviceException)              ||
|   |   |   |   | ↳ | [com.google.ambient.crossdevice.sessions.SessionException](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException) |

*** ** * ** ***

Exception for session requests.[Result](https://developer.android.com/reference/kotlin/Result)or[ListenableFuture](https://developer.android.com/reference/com/google/common/util/concurrent/ListenableFuture)returned from APIs in[Sessions](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/Sessions)may fail with this exception.

## Summary

|                                                                     ### Nested types                                                                      ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [SessionException.Companion](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException.Companion)               |   |
| [SessionException.SessionErrorCode](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException.SessionErrorCode) |   |

|                                                                                                                                                             ### Public fields                                                                                                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[SessionException.SessionErrorCode](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException.SessionErrorCode)` int` | [errorCode](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException#errorCode()) The error code associated with this exception. |

|                                                                                                                                                                                                                                                           ### Public constructors                                                                                                                                                                                                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [SessionException](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException#SessionException(kotlin.Int,kotlin.String,kotlin.Throwable))`(` ` @`[SessionException.SessionErrorCode](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException.SessionErrorCode)` int errorCode,` ` `[String](https://developer.android.com/reference/java/lang/String)` message,` ` `[Throwable](https://developer.android.com/reference/java/lang/Throwable)` cause` `)` |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ### Inherited methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| From class[kotlin.Throwable](https://developer.android.com/reference/kotlin/Throwable) |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `final void`                                                                                                                                                                                                                                                   | [addSuppressed](https://developer.android.com/reference/java/lang/Throwable#addSuppressed(kotlin.Throwable))`(@`[RecentlyNonNull](https://developer.android.com/reference/androidx/annotation/RecentlyNonNull)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[Throwable](https://developer.android.com/reference/java/lang/Throwable)` p0)`          | | `@`[RecentlyNonNull](https://developer.android.com/reference/androidx/annotation/RecentlyNonNull)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[Throwable](https://developer.android.com/reference/java/lang/Throwable) | [fillInStackTrace](https://developer.android.com/reference/java/lang/Throwable#fillInStackTrace())`()`                                                                                                                                                                                                                                                                                     | | `@`[RecentlyNullable](https://developer.android.com/reference/androidx/annotation/RecentlyNullable)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[String](https://developer.android.com/reference/java/lang/String)     | [getLocalizedMessage](https://developer.android.com/reference/java/lang/Throwable#getLocalizedMessage())`()`                                                                                                                                                                                                                                                                               | | `@`[RecentlyNonNull](https://developer.android.com/reference/androidx/annotation/RecentlyNonNull)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` StackTraceElement[]`                                                      | [getStackTrace](https://developer.android.com/reference/java/lang/Throwable#getStackTrace())`()`                                                                                                                                                                                                                                                                                           | | `final @`[RecentlyNonNull](https://developer.android.com/reference/androidx/annotation/RecentlyNonNull)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` Throwable[]`                                                        | [getSuppressed](https://developer.android.com/reference/java/lang/Throwable#getSuppressed())`()`                                                                                                                                                                                                                                                                                           | | `@`[RecentlyNonNull](https://developer.android.com/reference/androidx/annotation/RecentlyNonNull)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[Throwable](https://developer.android.com/reference/java/lang/Throwable) | [initCause](https://developer.android.com/reference/java/lang/Throwable#initCause(kotlin.Throwable))`(@`[RecentlyNullable](https://developer.android.com/reference/androidx/annotation/RecentlyNullable)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[Throwable](https://developer.android.com/reference/java/lang/Throwable)` p0)`                | | `void`                                                                                                                                                                                                                                                         | [printStackTrace](https://developer.android.com/reference/java/lang/Throwable#printStackTrace())`()`                                                                                                                                                                                                                                                                                       | | `void`                                                                                                                                                                                                                                                         | [printStackTrace](https://developer.android.com/reference/java/lang/Throwable#printStackTrace(java.io.PrintStream))`(@`[RecentlyNonNull](https://developer.android.com/reference/androidx/annotation/RecentlyNonNull)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[PrintStream](https://developer.android.com/reference/java/io/PrintStream)` p0)` | | `void`                                                                                                                                                                                                                                                         | [printStackTrace](https://developer.android.com/reference/java/lang/Throwable#printStackTrace(java.io.PrintWriter))`(@`[RecentlyNonNull](https://developer.android.com/reference/androidx/annotation/RecentlyNonNull)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` `[PrintWriter](https://developer.android.com/reference/java/io/PrintWriter)` p0)` | | `void`                                                                                                                                                                                                                                                         | [setStackTrace](https://developer.android.com/reference/java/lang/Throwable#setStackTrace(kotlin.Array))`(@`[RecentlyNonNull](https://developer.android.com/reference/androidx/annotation/RecentlyNonNull)` @`[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull)` StackTraceElement[] p0)`                                                                     | |

|                                                                                                                                                                                                                                                                ### Inherited fields                                                                                                                                                                                                                                                                 ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| From class[com.google.ambient.crossdevice.CrossDeviceException](https://developer.android.com/reference/com/google/ambient/crossdevice/CrossDeviceException) |--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------| | [String](https://developer.android.com/reference/java/lang/String) | [message](https://developer.android.com/reference/com/google/ambient/crossdevice/CrossDeviceException#message()) | |
| From class[kotlin.Throwable](https://developer.android.com/reference/kotlin/Throwable) |--------------------------------------------------------------------------|---------------------------------------------------------------------------| | [Throwable](https://developer.android.com/reference/java/lang/Throwable) | [cause](https://developer.android.com/reference/kotlin/Throwable#cause()) |                                                                                                                                         |

## Public fields

### errorCode

```
public @SessionException.SessionErrorCode int errorCode
```

The error code associated with this exception. Refer to the concrete implementations for the possible error codes and their meanings.  

|                                                              See also                                                              ||
|---------------------------------------------------------------------------------------------------------------------------------|---|
| [ConnectionsException](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/ConnectionsException) |   |
| [SessionException](https://developer.android.com/reference/com/google/ambient/crossdevice/sessions/SessionException)            |   |

## Public constructors

### SessionException

```
public final SessionException(
    @SessionException.SessionErrorCode int errorCode,
    String message,
    Throwable cause
)
```