# CompletionException

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# CompletionException

```
open class CompletionException : RuntimeException
```

|---|---|---|---|--------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                |||||
| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)                                                 ||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/kotlin/java/lang/Exception.html#)                                            |||
|   |   | ↳ | [java.lang.RuntimeException](https://developer.android.com/reference/kotlin/java/lang/RuntimeException.html#)                           ||
|   |   |   | ↳ | [java.util.concurrent.CompletionException](https://developer.android.com/reference/kotlin/java/util/concurrent/CompletionException#) |

Exception thrown when an error or other exception is encountered in the course of completing a result or task.

## Summary

|                                                                                                                                                                                                                     Public constructors                                                                                                                                                                                                                      ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [CompletionException](https://developer.android.com/reference/kotlin/java/util/concurrent/CompletionException#CompletionException(kotlin.String,%20kotlin.Throwable))`(`message:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `cause:` `[Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)!`)` Constructs a`CompletionException`with the specified detail message and cause. |
| [CompletionException](https://developer.android.com/reference/kotlin/java/util/concurrent/CompletionException#CompletionException(kotlin.Throwable))`(`cause:` `[Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)!`)` Constructs a`CompletionException`with the specified cause.                                                                                                                                     |

|                                                                                                                                                   Protected constructors                                                                                                                                                   ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [CompletionException](https://developer.android.com/reference/kotlin/java/util/concurrent/CompletionException#CompletionException())`()` Constructs a`CompletionException`with no detail message.                                                                                                                       |
| [CompletionException](https://developer.android.com/reference/kotlin/java/util/concurrent/CompletionException#CompletionException(kotlin.String))`(`message:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructs a`CompletionException`with the specified detail message. |

## Public constructors

### CompletionException

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
CompletionException(
    message: String!, 
    cause: Throwable!)
```

Constructs a`CompletionException`with the specified detail message and cause.

|                                                                                                                           Parameters                                                                                                                           ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `message` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the detail message                                                                                                                                                |
| `cause`   | [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)!:the cause (which is saved for later retrieval by the[getCause()](https://developer.android.com/reference/kotlin/java/lang/Throwable.html#getCause())method) |

### CompletionException

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
CompletionException(cause: Throwable!)
```

Constructs a`CompletionException`with the specified cause. The detail message is set to`(cause == null ? null : cause.toString())`(which typically contains the class and detail message of`cause`).

|                                                                                                                          Parameters                                                                                                                          ||
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cause` | [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)!:the cause (which is saved for later retrieval by the[getCause()](https://developer.android.com/reference/kotlin/java/lang/Throwable.html#getCause())method) |

## Protected constructors

### CompletionException

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
protected CompletionException()
```

Constructs a`CompletionException`with no detail message. The cause is not initialized, and may subsequently be initialized by a call to[initCause](https://developer.android.com/reference/kotlin/java/lang/Throwable.html#initCause(kotlin.Throwable)).  

### CompletionException

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
protected CompletionException(message: String!)
```

Constructs a`CompletionException`with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to[initCause](https://developer.android.com/reference/kotlin/java/lang/Throwable.html#initCause(kotlin.Throwable)).

|                                                   Parameters                                                    ||
|-----------|------------------------------------------------------------------------------------------------------|
| `message` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the detail message |