# CreateCredentialException

Artifact: [androidx.credentials:credentials](https://developer.android.com/jetpack/androidx/releases/credentials) [View Source](https://cs.android.com/search?q=file:androidx/credentials/exceptions/CreateCredentialException.kt+class:androidx.credentials.exceptions.CreateCredentialException) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

*** ** * ** ***

<br />

```
abstract class CreateCredentialException : Exception
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) |||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) ||
|   |   | ↳ | [androidx.credentials.exceptions.CreateCredentialException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException) |

Known direct subclasses [CreateCredentialCancellationException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialCancellationException), [CreateCredentialCustomException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialCustomException), [CreateCredentialInterruptedException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialInterruptedException), [CreateCredentialNoCreateOptionException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialNoCreateOptionException), [CreateCredentialProviderConfigurationException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialProviderConfigurationException), [CreateCredentialUnknownException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialUnknownException), [CreateCredentialUnsupportedException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialUnsupportedException), [CreatePublicKeyCredentialException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialException), [CreateRestoreCredentialDomException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/restorecredential/CreateRestoreCredentialDomException), [E2eeUnavailableException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/restorecredential/E2eeUnavailableException)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialCancellationException` | During the create credential flow, this is thrown when a user intentionally cancels an operation. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialCustomException` | Represents a custom error thrown during a create flow with `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager`. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialInterruptedException` | During the create credential flow, this is thrown when some interruption occurs that may warrant retrying or at least does not indicate a purposeful desire to close or tap away from credential manager. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialNoCreateOptionException` | During the create credential flow, this is thrown when no viable creation options were found for the given `https://developer.android.com/reference/kotlin/androidx/credentials/CreateCredentialRequest`. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialProviderConfigurationException` | During the create credential flow, this is thrown when configurations are mismatched for the provider, typically indicating the provider dependency is missing in the manifest or some system service is not enabled. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialUnknownException` | This is thrown when the create credential operation failed with no more detailed information. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialUnsupportedException` | During the create credential flow, this is thrown when credential manager is unsupported, typically because the device has disabled it or did not ship with this feature enabled. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialException` | A subclass of CreateCredentialException for unique exceptions thrown specific only to PublicKeyCredentials. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/restorecredential/CreateRestoreCredentialDomException` | During the create restore credential flow, this is thrown when a DOM Exception is thrown, indicating the operation contains a DOMException error type. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/restorecredential/E2eeUnavailableException` | During the Restore Credential creation, this is thrown when the developer requests backup to cloud but the user device did not enable end-to-end-encryption or backup. |

Known indirect subclasses [CreatePublicKeyCredentialDomException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomException)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/publickeycredential/CreatePublicKeyCredentialDomException` | During the create-passkey flow, this is thrown when a DOM Exception is thrown, indicating the operation contains a DOMException error type. |

*** ** * ** ***

Represents an error thrown during a create flow with Credential Manager. See `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager` for more details on how Exceptions work for Credential Manager flows.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager` |   |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialInterruptedException` |   |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialCancellationException` |   |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialUnknownException` |   |

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException#asBundle(androidx.credentials.exceptions.CreateCredentialException)(ex: https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException)` Helper method to convert the given `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException.Companion#asBundle(androidx.credentials.exceptions.CreateCredentialException)` to a parcelable `https://developer.android.com/reference/android/os/Bundle.html`, in case the instance needs to be sent across a process. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException` | `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException#fromBundle(android.os.Bundle)(bundle: https://developer.android.com/reference/android/os/Bundle.html)` Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException#asBundle(androidx.credentials.exceptions.CreateCredentialException)`, back to an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException`. |

### Inherited functions

From [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/add-suppressed.html(exception: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/fill-in-stack-trace.html()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/init-cause.html(cause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html(s: https://developer.android.com/reference/java/io/PrintStream.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html(s: https://developer.android.com/reference/java/io/PrintWriter.html)`

### Inherited properties

From [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html?` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/cause.html` `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/localized-message.html` `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/message.html` `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/java/lang/StackTraceElement.html>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/stack-trace.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/suppressed.html`

## Public companion functions

### asBundle

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
fun asBundle(ex: CreateCredentialException): Bundle
```

Helper method to convert the given `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException.Companion#asBundle(androidx.credentials.exceptions.CreateCredentialException)` to a parcelable `https://developer.android.com/reference/android/os/Bundle.html`, in case the instance needs to be sent across a process. Consumers of this method should use `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException#fromBundle(android.os.Bundle)` to reconstruct the class instance back from the bundle returned here.

### fromBundle

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
fun fromBundle(bundle: Bundle): CreateCredentialException
```

Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException#asBundle(androidx.credentials.exceptions.CreateCredentialException)`, back to an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException`.

Throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the conversion fails. This means that the given `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException.Companion#fromBundle(android.os.Bundle)` does not contain a `CreateCredentialException`. The bundle should be constructed and retrieved from `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/CreateCredentialException#asBundle(androidx.credentials.exceptions.CreateCredentialException)` itself and never be created from scratch to avoid the failure.