GetCredentialException


public class GetCredentialException
extends Exception



Represents an error encountered during the CredentialManager.getCredential(Context,GetCredentialRequest,CancellationSignal,Executor,OutcomeReceiver) operation.

Summary

Constants

String TYPE_INTERRUPTED

The error type value for when the given operation failed due to internal interruption.

String TYPE_NO_CREDENTIAL

The error type value for when no credential is found available for the given CredentialManager.getCredential(Context,GetCredentialRequest,CancellationSignal,Executor,OutcomeReceiver) request.

String TYPE_UNKNOWN

The error type value for when the given operation failed due to an unknown reason.

String TYPE_USER_CANCELED

The error type value for when the user intentionally cancelled the request.

Public constructors

GetCredentialException(String type)

Constructs a GetCredentialException.

GetCredentialException(String type, String message)

Constructs a GetCredentialException.

GetCredentialException(String type, String message, Throwable cause)

Constructs a GetCredentialException.

GetCredentialException(String type, Throwable cause)

Constructs a GetCredentialException.

Public methods

String getType()

Returns the specific exception type.

Inherited methods

Constants

TYPE_INTERRUPTED

Added in API level 34
public static final String TYPE_INTERRUPTED

The error type value for when the given operation failed due to internal interruption. Retrying the same operation should fix the error.

Constant Value: "android.credentials.GetCredentialException.TYPE_INTERRUPTED"

TYPE_NO_CREDENTIAL

Added in API level 34
public static final String TYPE_NO_CREDENTIAL

The error type value for when no credential is found available for the given CredentialManager.getCredential(Context,GetCredentialRequest,CancellationSignal,Executor,OutcomeReceiver) request.

Constant Value: "android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL"

TYPE_UNKNOWN

Added in API level 34
public static final String TYPE_UNKNOWN

The error type value for when the given operation failed due to an unknown reason.

Constant Value: "android.credentials.GetCredentialException.TYPE_UNKNOWN"

TYPE_USER_CANCELED

Added in API level 34
public static final String TYPE_USER_CANCELED

The error type value for when the user intentionally cancelled the request.

This is a strong indicator that your app should refrain from making the same api call for a certain amount of time to provide a better user experience.

Constant Value: "android.credentials.GetCredentialException.TYPE_USER_CANCELED"

Public constructors

GetCredentialException

Added in API level 34
public GetCredentialException (String type)

Constructs a GetCredentialException.

Parameters
type String: This value cannot be null.
Throws
IllegalArgumentException If type is empty.

GetCredentialException

Added in API level 34
public GetCredentialException (String type, 
                String message)

Constructs a GetCredentialException.

Parameters
type String: This value cannot be null.
message String: This value may be null.
Throws
IllegalArgumentException If type is empty.

GetCredentialException

Added in API level 34
public GetCredentialException (String type, 
                String message, 
                Throwable cause)

Constructs a GetCredentialException.

Parameters
type String: This value cannot be null.
message String: This value may be null.
cause Throwable: This value may be null.
Throws
IllegalArgumentException If type is empty.

GetCredentialException

Added in API level 34
public GetCredentialException (String type, 
                Throwable cause)

Constructs a GetCredentialException.

Parameters
type String: This value cannot be null.
cause Throwable: This value may be null.
Throws
IllegalArgumentException If type is empty.

Public methods

getType

Added in API level 34
public String getType ()

Returns the specific exception type.