public class

AuthError

extends Exception
implements Parcelable IAuthError
java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ com.amazon.identity.auth.device.AuthError

Class Overview

This class encapsulates errors from External API Methods.

These errors are passed through onError or it can be put into an Intent Bundle for an error Activity result.

Some instances of AuthError will contain a cause which will indicate the Exception that caused this AuthError.

This class also implements Parcelable so that AuthError objects can be put into a Bundle.

All known errors will create a specific AuthError.ERROR_CATEGORY and AuthError.ERROR_TYPE, along with a message. If there is an exception it will be added to the AuthError cause attribute. Below are the following error categories:

  • ACTION - Some action is required by the calling application in order to address this issue. Consult the method documentation for specific error types (AuthError.ERROR_TYPE) and what actions are required.
  • NETWORK - Depending on the error type and the cause, you may want to retry the operation or alert the user.
  • INTERNAL - Please report errors in these categories to our SDK support team and provide logs. The type and cause may provide additional information in diagnosing the error.
  • UNKNOWN - Please report errors in these categories to our SDK support team and provide logs. The type and cause may provide additional information in diagnosing the error.
  • BAD_REQUEST - This is not currently used by this SDK.

All unhandled exceptions will create an Unknown Error in Unknown Category, along with a message and if there is an exception that triggered this it will be added to the AuthError cause attribute.

See Also

Summary

Nested Classes
enum AuthError.ERROR_CATEGORY Each AuthError has a category to help clients determine what generic action they want to take  
enum AuthError.ERROR_TYPE Each AuthError has a type to help clients determine what detailed action they want to take  
Constants
String AUTH_ERROR_EXECEPTION The name(key) used in an Intent bundle to store an AuthError object for Activity results
int RESULT_AUTH_ERROR Result Type returned when an Activity returns an error
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<AuthError> CREATOR Helper method that generates instances of this Parcelable class from a Parcel.
Public Constructors
AuthError(String detailMessage, AuthError.ERROR_TYPE type)
AuthError(String detailMessage, Throwable throwable, AuthError.ERROR_TYPE type)
AuthError(Parcel source)
Reconstruct AuthError object from a Parcel
Public Methods
IBinder asBinder()
Implements an AIDL interface so that it can be used in the AuthorizationListener AIDL
int describeContents()
static AuthError extractError(Intent intent)
Helper Method to extract an AuthError from an Intent.
static AuthError extractError(Bundle bundle)
Helper Method to extract an AuthError from a Bundle.
static <T> AuthError getAuthError(Throwable throwable, Class<T> c)
Helper Method that gets a general AuthError object for unexpected errors, the class is passed in so that a more detailed message can be generated.
static <T> AuthError getAuthError(Throwable throwable, Class<T> c, AuthError.ERROR_TYPE type)
Helper Method to that gets a general AuthError object for specific errors, the class is passed in so that a more detailed message can be generated.
AuthError.ERROR_CATEGORY getCategory()
static Bundle getErrorBundle(AuthError e)
Helper Method to put the AuthError in a Bundle
static Bundle getErrorBundle(Intent intent)
Helper Method to help an Intent that has an AuthError put the AuthError in a Bundle
static <T> Bundle getErrorBundle(Throwable throwable, Class<T> c, AuthError.ERROR_TYPE authErrorType)
Helper Method that generates a Bundle with an AuthError in it based upon the throwable and the type, the class is passed in so that a more detailed message can be generated.
AuthError.ERROR_TYPE getType()
String toString()
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Throwable
From class java.lang.Object
From interface android.os.IInterface
From interface android.os.Parcelable

Constants

public static final String AUTH_ERROR_EXECEPTION

The name(key) used in an Intent bundle to store an AuthError object for Activity results

Constant Value: "AUTH_ERROR_EXECEPTION"

public static final int RESULT_AUTH_ERROR

Result Type returned when an Activity returns an error

Constant Value: 1 (0x00000001)

Fields

public static final Creator<AuthError> CREATOR

Helper method that generates instances of this Parcelable class from a Parcel.

Public Constructors

public AuthError (String detailMessage, AuthError.ERROR_TYPE type)

public AuthError (String detailMessage, Throwable throwable, AuthError.ERROR_TYPE type)

public AuthError (Parcel source)

Reconstruct AuthError object from a Parcel

Public Methods

public IBinder asBinder ()

Implements an AIDL interface so that it can be used in the AuthorizationListener AIDL

public int describeContents ()

public static AuthError extractError (Intent intent)

Helper Method to extract an AuthError from an Intent. This will also log any exceptions thrown.

Returns
  • AuthError object - if no AuthError object can be found or there is an exception the return is set to NULL

public static AuthError extractError (Bundle bundle)

Helper Method to extract an AuthError from a Bundle. This will also log any exceptions thrown.

Returns
  • AuthError object - if no AuthError object can be found or there is an exception the return is set to NULL

public static AuthError getAuthError (Throwable throwable, Class<T> c)

Helper Method that gets a general AuthError object for unexpected errors, the class is passed in so that a more detailed message can be generated.

Returns
  • AuthError

public static AuthError getAuthError (Throwable throwable, Class<T> c, AuthError.ERROR_TYPE type)

Helper Method to that gets a general AuthError object for specific errors, the class is passed in so that a more detailed message can be generated.

Returns
  • AuthError

public AuthError.ERROR_CATEGORY getCategory ()

Returns
  • ERROR_CATEGORY

public static Bundle getErrorBundle (AuthError e)

Helper Method to put the AuthError in a Bundle

Returns
  • Bundle

public static Bundle getErrorBundle (Intent intent)

Helper Method to help an Intent that has an AuthError put the AuthError in a Bundle

Returns
  • Bundle

public static Bundle getErrorBundle (Throwable throwable, Class<T> c, AuthError.ERROR_TYPE authErrorType)

Helper Method that generates a Bundle with an AuthError in it based upon the throwable and the type, the class is passed in so that a more detailed message can be generated.

Returns
  • Bundle

public AuthError.ERROR_TYPE getType ()

Returns
  • ERROR_TYPE

public String toString ()

See Also

public void writeToParcel (Parcel dest, int flags)