AppSearchException


class AppSearchException : Exception


An exception thrown by androidx.appsearch.app.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 functions

Int

Returns the result code this exception was constructed with.

AppSearchResult<T!>

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

Public constructors

AppSearchException

Added in 1.1.0-alpha07
AppSearchException(resultCode: Int)

Initializes an AppSearchException with no message.

Parameters
resultCode: Int

One of the constants documented in getResultCode.

AppSearchException

Added in 1.1.0-alpha07
AppSearchException(resultCode: Int, message: String?)

Initializes an AppSearchException with a result code and message.

Parameters
resultCode: Int

One of the constants documented in getResultCode.

message: String?

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

AppSearchException

Added in 1.1.0-alpha07
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 getResultCode.

message: String?

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

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 functions

getResultCode

Added in 1.1.0-alpha07
fun getResultCode(): Int

Returns the result code this exception was constructed with.

Returns
Int

One of the constants documented in getResultCode.

toAppSearchResult

Added in 1.1.0-alpha07
fun <T> toAppSearchResult(): AppSearchResult<T!>

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