Added in API level 31

AppSearchException


open class AppSearchException : Exception
kotlin.Any
   ↳ kotlin.Throwable
   ↳ java.lang.Exception
   ↳ android.app.appsearch.exceptions.AppSearchException

An exception thrown by android.app.appsearch.AppSearchSession or a subcomponent.

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

Summary

Public constructors
AppSearchException(resultCode: Int)

Initializes an AppSearchException with no message.

AppSearchException(resultCode: Int, message: String?)

Initializes an AppSearchException with a result code and message.

AppSearchException(resultCode: Int, message: String?, cause: Throwable?)

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

Public methods
open Int

Returns the result code this exception was constructed with.

open AppSearchResult<T>

Converts this java.lang.Exception into a failed AppSearchResult.

Public constructors

AppSearchException

Added in API level 31
AppSearchException(
    resultCode: Int,
    message: String?,
    cause: Throwable?)

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

Parameters
resultCode Int: One of the constants documented in AppSearchResult.getResultCode. Value is android.app.appsearch.AppSearchResult#RESULT_OK, android.app.appsearch.AppSearchResult#RESULT_UNKNOWN_ERROR, android.app.appsearch.AppSearchResult#RESULT_INTERNAL_ERROR, android.app.appsearch.AppSearchResult#RESULT_INVALID_ARGUMENT, android.app.appsearch.AppSearchResult#RESULT_IO_ERROR, android.app.appsearch.AppSearchResult#RESULT_OUT_OF_SPACE, android.app.appsearch.AppSearchResult#RESULT_NOT_FOUND, android.app.appsearch.AppSearchResult#RESULT_INVALID_SCHEMA, android.app.appsearch.AppSearchResult#RESULT_SECURITY_ERROR, android.app.appsearch.AppSearchResult#RESULT_DENIED, android.app.appsearch.AppSearchResult#RESULT_RATE_LIMITED, android.app.appsearch.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 getMessage() method). This value may be null.
cause Throwable?: The cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Public methods

toAppSearchResult

Added in API level 31
open fun <T : Any!> toAppSearchResult(): AppSearchResult<T>

Converts this java.lang.Exception into a failed AppSearchResult.

Return
AppSearchResult<T> This value cannot be null.