AppSearchException

public class AppSearchException
extends Exception

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ androidx.appsearch.exceptions.AppSearchException


An exception thrown by AppSearchSession or a subcomponent.

These exceptions can be converted into a failed AppSearchResult for propagating to the client.

Summary

Public constructors

AppSearchException(int resultCode)

Initializes an AppSearchException with no message.

AppSearchException(int resultCode, String message)

Initializes an AppSearchException with a result code and message.

AppSearchException(int resultCode, String message, Throwable cause)

Initializes an AppSearchException with a result code, message and cause.

Public methods

int getResultCode()

Returns the result code this exception was constructed with.

<T> AppSearchResult<T> toAppSearchResult()

Converts this Exception into a failed AppSearchResult.

Inherited methods

Public constructors

AppSearchException

public AppSearchException (int resultCode)

Initializes an AppSearchException with no message.

Parameters
resultCode int: One of the constants documented in AppSearchResult.getResultCode().

AppSearchException

public AppSearchException (int resultCode, 
                String message)

Initializes an AppSearchException with a result code and message.

Parameters
resultCode int: One of the constants documented in AppSearchResult.getResultCode().

message String: The detail message (which is saved for later retrieval by the Throwable.getMessage() method).

AppSearchException

public AppSearchException (int resultCode, 
                String message, 
                Throwable cause)

Initializes an AppSearchException with a result code, message and cause.

Parameters
resultCode int: One of the constants documented in AppSearchResult.getResultCode().

message String: The detail message (which is saved for later retrieval by the Throwable.getMessage() method).

cause Throwable: The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Public methods

getResultCode

public int getResultCode ()

Returns the result code this exception was constructed with.

Returns
int One of the constants documented in AppSearchResult.getResultCode().

toAppSearchResult

public AppSearchResult<T> toAppSearchResult ()

Converts this Exception into a failed AppSearchResult.

Returns
AppSearchResult<T>