# 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)

*** ** * ** ***


```
public abstract class ClearCredentialException extends Exception
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [kotlin.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) |||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) ||
|   |   | ↳ | [androidx.credentials.exceptions.ClearCredentialException](https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialException) |

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

|---|---|
| `https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialCustomException` | Represents a custom error thrown during a clear flow with `https://developer.android.com/reference/androidx/credentials/CredentialManager`. |
| `https://developer.android.com/reference/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/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/androidx/credentials/exceptions/ClearCredentialUnknownException` | This is thrown when the clear credential operation failed with no more detailed information. |
| `https://developer.android.com/reference/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/androidx/credentials/CredentialManager` for more details on how Exceptions work for Credential Manager flows.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/credentials/CredentialManager` |   |
| `https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialInterruptedException` |   |
| `https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialUnknownException` |   |

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialException#asBundle(androidx.credentials.exceptions.ClearCredentialException)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialException ex)` Helper method to convert the given `https://developer.android.com/reference/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. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialException` | `https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialException#fromBundle(android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html bundle)` Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialException#asBundle(androidx.credentials.exceptions.ClearCredentialException)`, back to an instance of `https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialException`. |

### Inherited methods

From [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) `final void` `https://developer.android.com/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html exception)` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#fillInStackTrace()()` `https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#getCause()()` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `@https://developer.android.com/reference/androidx/annotation/RecentlyNullable
https://developer.android.com/reference/java/lang/Throwable.html#getLocalizedMessage()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#getMessage()()` `@https://developer.android.com/reference/androidx/annotation/NonNull StackTraceElement[]` `@https://developer.android.com/reference/androidx/annotation/RecentlyNonNull
https://developer.android.com/reference/java/lang/Throwable.html#getStackTrace()()` `final @https://developer.android.com/reference/androidx/annotation/NonNull Throwable[]` `@https://developer.android.com/reference/androidx/annotation/RecentlyNonNull
https://developer.android.com/reference/java/lang/Throwable.html#getSuppressed()()` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#initCause(java.lang.Throwable)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html cause)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace()()` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintStream)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/PrintStream.html s)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/PrintWriter.html s)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[])(@https://developer.android.com/reference/androidx/annotation/NonNull StackTraceElement[] stackTrace)`

## Public methods

### asBundle

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

```
public static final @NonNull Bundle asBundle(@NonNull ClearCredentialException ex)
```

Helper method to convert the given `https://developer.android.com/reference/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/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)

```
public static final @NonNull ClearCredentialException fromBundle(@NonNull Bundle bundle)
```

Helper method to convert a `https://developer.android.com/reference/android/os/Bundle.html` retrieved through `https://developer.android.com/reference/androidx/credentials/exceptions/ClearCredentialException#asBundle(androidx.credentials.exceptions.ClearCredentialException)`, back to an instance of `https://developer.android.com/reference/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/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/androidx/credentials/exceptions/ClearCredentialException#asBundle(androidx.credentials.exceptions.ClearCredentialException)` itself and never be created from scratch to avoid the failure.