AppSearchException


public class AppSearchException
extends Exception

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ android.app.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

Added in API level 31
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. Value is AppSearchResult.RESULT_OK, AppSearchResult.RESULT_UNKNOWN_ERROR, AppSearchResult.RESULT_INTERNAL_ERROR, AppSearchResult.RESULT_INVALID_ARGUMENT, AppSearchResult.RESULT_IO_ERROR, AppSearchResult.RESULT_OUT_OF_SPACE, AppSearchResult.RESULT_NOT_FOUND, AppSearchResult.RESULT_INVALID_SCHEMA, AppSearchResult.RESULT_SECURITY_ERROR, AppSearchResult.RESULT_DENIED, AppSearchResult.RESULT_RATE_LIMITED, AppSearchResult.RESULT_TIMED_OUT, or android.app.appsearch.AppSearchResult.RESULT_ALREADY_EXISTS

message String: The detail message (which is saved for later retrieval by the Throwable.getMessage() method). This value may be null.

AppSearchException

Added in API level 31
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. Value is AppSearchResult.RESULT_OK, AppSearchResult.RESULT_UNKNOWN_ERROR, AppSearchResult.RESULT_INTERNAL_ERROR, AppSearchResult.RESULT_INVALID_ARGUMENT, AppSearchResult.RESULT_IO_ERROR, AppSearchResult.RESULT_OUT_OF_SPACE, AppSearchResult.RESULT_NOT_FOUND, AppSearchResult.RESULT_INVALID_SCHEMA, AppSearchResult.RESULT_SECURITY_ERROR, AppSearchResult.RESULT_DENIED, AppSearchResult.RESULT_RATE_LIMITED, AppSearchResult.RESULT_TIMED_OUT, or android.app.appsearch.AppSearchResult.RESULT_ALREADY_EXISTS

message String: The detail message (which is saved for later retrieval by the Throwable.getMessage() method). This value may be null.

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

toAppSearchResult

Added in API level 31
public AppSearchResult<T> toAppSearchResult ()

Converts this Exception into a failed AppSearchResult.

Returns
AppSearchResult<T> This value cannot be null.