# ConnectionsException

# ConnectionsException

*** ** * ** ***

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

<br />

```
@RequiresApi(value = 26) public final class ConnectionsException 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.connections.ConnectionsException](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/ConnectionsException) |

*** ** * ** ***

Exception for connections requests.[Result](https://developer.android.com/reference/kotlin/Result)or[ListenableFuture](https://developer.android.com/reference/com/google/common/util/concurrent/ListenableFuture)returned from[Participant.openConnection](https://developer.android.com/reference/com/google/ambient/crossdevice/Participant#openConnection(kotlin.String))or[Participant.acceptConnection](https://developer.android.com/reference/com/google/ambient/crossdevice/Participant#acceptConnection(kotlin.String))may fail with this exception.

## Summary

|                                                                               ### Nested types                                                                               ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ConnectionsException.Companion](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/ConnectionsException.Companion)                       |   |
| [ConnectionsException.ConnectionsErrorCode](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/ConnectionsException.ConnectionsErrorCode) |   |

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

|                                                                                                                                                                                                                                                                            ### Public constructors                                                                                                                                                                                                                                                                            ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ConnectionsException](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/ConnectionsException#ConnectionsException(kotlin.Int,kotlin.String,kotlin.Throwable))`(` ` @`[ConnectionsException.ConnectionsErrorCode](https://developer.android.com/reference/com/google/ambient/crossdevice/connections/ConnectionsException.ConnectionsErrorCode)` 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 @ConnectionsException.ConnectionsErrorCode 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

### ConnectionsException

```
public final ConnectionsException(
    @ConnectionsException.ConnectionsErrorCode int errorCode,
    String message,
    Throwable cause
)
```