AppSearchException


public class AppSearchException extends 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(int resultCode)

Initializes an AppSearchException with no message.

AppSearchException(int resultCode, @Nullable String message)

Initializes an AppSearchException with a result code and message.

AppSearchException(
    int resultCode,
    @Nullable String message,
    @Nullable Throwable cause
)

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

Public methods

int

Returns the result code this exception was constructed with.

@NonNull AppSearchResult<T>

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

Inherited methods

From java.lang.Throwable
synchronized final void
synchronized Throwable
synchronized Throwable
String
String
StackTraceElement[]
synchronized final Throwable[]
synchronized Throwable
void
void
setStackTrace(StackTraceElement[] stackTrace)
String

Public constructors

AppSearchException

Added in 1.1.0-alpha06
public AppSearchException(int resultCode)

Initializes an AppSearchException with no message.

Parameters
int resultCode

One of the constants documented in getResultCode.

AppSearchException

Added in 1.1.0-alpha06
public AppSearchException(int resultCode, @Nullable String message)

Initializes an AppSearchException with a result code and message.

Parameters
int resultCode

One of the constants documented in getResultCode.

@Nullable String message

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

AppSearchException

Added in 1.1.0-alpha06
public AppSearchException(
    int resultCode,
    @Nullable String message,
    @Nullable Throwable cause
)

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

Parameters
int resultCode

One of the constants documented in getResultCode.

@Nullable String message

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

@Nullable Throwable cause

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

getResultCode

Added in 1.1.0-alpha06
public int getResultCode()

Returns the result code this exception was constructed with.

Returns
int

One of the constants documented in getResultCode.

toAppSearchResult

Added in 1.1.0-alpha06
public @NonNull AppSearchResult<T> <T> toAppSearchResult()

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