# ClearCredentialException

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

*** ** * ** ***

<br />

```
abstract class ClearCredentialException : 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.ClearCredentialException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException) |

Known direct subclasses [ClearCredentialCustomException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialCustomException), [ClearCredentialInterruptedException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialInterruptedException), [ClearCredentialProviderConfigurationException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialProviderConfigurationException), [ClearCredentialUnknownException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialUnknownException), [ClearCredentialUnsupportedException](https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialUnsupportedException)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialCustomException` | Represents a custom error thrown during a clear flow with `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager`. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialInterruptedException` | During the clear 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/ClearCredentialProviderConfigurationException` | During the clear 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/ClearCredentialUnknownException` | This is thrown when the clear credential operation failed with no more detailed information. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialUnsupportedException` | During the clear 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. |

*** ** * ** ***

Represents an error thrown during a clear 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/ClearCredentialInterruptedException` |   |
| `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialUnknownException` |   |

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException#asBundle(androidx.credentials.exceptions.ClearCredentialException)(ex: https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException)` Helper method to convert the given `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException.Companion#asBundle(androidx.credentials.exceptions.ClearCredentialException)` 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/ClearCredentialException` | `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException#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/ClearCredentialException#asBundle(androidx.credentials.exceptions.ClearCredentialException)`, back to an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException`. |

### 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: ClearCredentialException): Bundle
```

Helper method to convert the given `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException.Companion#asBundle(androidx.credentials.exceptions.ClearCredentialException)` 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/ClearCredentialException#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): ClearCredentialException
```

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/ClearCredentialException#asBundle(androidx.credentials.exceptions.ClearCredentialException)`, back to an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException`.

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/ClearCredentialException.Companion#fromBundle(android.os.Bundle)` does not contain a `ClearCredentialException`. The bundle should be constructed and retrieved from `https://developer.android.com/reference/kotlin/androidx/credentials/exceptions/ClearCredentialException#asBundle(androidx.credentials.exceptions.ClearCredentialException)` itself and never be created from scratch to avoid the failure.