# GetCredentialException

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

*** ** * ** ***


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

Known direct subclasses [GetCredentialCancellationException](https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialCancellationException), [GetCredentialCustomException](https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialCustomException), [GetCredentialInterruptedException](https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialInterruptedException), [GetCredentialProviderConfigurationException](https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialProviderConfigurationException), [GetCredentialUnknownException](https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialUnknownException), [GetCredentialUnsupportedException](https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialUnsupportedException), [GetPublicKeyCredentialException](https://developer.android.com/reference/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialException), [NoCredentialException](https://developer.android.com/reference/androidx/credentials/exceptions/NoCredentialException)

|---|---|
| `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialCancellationException` | During the get credential flow, this is thrown when a user intentionally cancels an operation. |
| `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialCustomException` | Represents a custom error thrown during a get flow with `https://developer.android.com/reference/androidx/credentials/CredentialManager`. |
| `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialInterruptedException` | During the get 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/GetCredentialProviderConfigurationException` | During the get 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/GetCredentialUnknownException` | This is thrown when the get credential operation failed with no more detailed information. |
| `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialUnsupportedException` | During the get 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/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialException` | A subclass of CreateCredentialException for unique exceptions thrown specific only to PublicKeyCredentials. |
| `https://developer.android.com/reference/androidx/credentials/exceptions/NoCredentialException` | During the get credential flow, this is returned when no viable credential is available for the the user. |

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

|---|---|
| `https://developer.android.com/reference/androidx/credentials/exceptions/publickeycredential/GetPublicKeyCredentialDomException` | During the get-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 get 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/GetCredentialUnknownException` |   |
| `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialCancellationException` |   |
| `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialInterruptedException` |   |

## 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/GetCredentialException#asBundle(androidx.credentials.exceptions.GetCredentialException)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialException ex)` Helper method to convert the given `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialException.Companion#asBundle(androidx.credentials.exceptions.GetCredentialException)` 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/GetCredentialException` | `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialException#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/GetCredentialException#asBundle(androidx.credentials.exceptions.GetCredentialException)`, back to an instance of `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialException`. |

### 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 GetCredentialException ex)
```

Helper method to convert the given `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialException.Companion#asBundle(androidx.credentials.exceptions.GetCredentialException)` 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/GetCredentialException#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 GetCredentialException 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/GetCredentialException#asBundle(androidx.credentials.exceptions.GetCredentialException)`, back to an instance of `https://developer.android.com/reference/androidx/credentials/exceptions/GetCredentialException`.

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