AppFunctionException


class AppFunctionException : Exception, Parcelable
kotlin.Any
   ↳ kotlin.Throwable
   ↳ java.lang.Exception
   ↳ android.app.appfunctions.AppFunctionException

Represents an app function related errors.

Summary

Constants
static Int

An unknown error occurred while processing the call in the AppFunctionService.

static Int

The operation was cancelled.

static Int

The error is caused by the app providing the function.

static Int

The error is caused by the app requesting a function execution.

static Int

The error is caused by an issue in the system.

static Int

The error category is unknown.

static Int

The caller does not have the permission to execute an app function.

static Int

The caller tried to execute a disabled app function.

static Int

The caller tried to execute a function that does not exist.

static Int

The caller supplied invalid arguments to the execution request.

static Int

An internal unexpected error coming from the system.

Inherited constants
Public constructors
AppFunctionException(errorCode: Int, errorMessage: String?)

AppFunctionException(errorCode: Int, errorMessage: String?, extras: Bundle)

Public methods
Int

Int

Returns the error category.

Int

Returns one of the ERROR constants.

String?

Returns the error message.

Bundle

Returns any extras associated with this error.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<AppFunctionException!>

Constants

ERROR_APP_UNKNOWN_ERROR

static val ERROR_APP_UNKNOWN_ERROR: Int

An unknown error occurred while processing the call in the AppFunctionService.

This error is thrown when the service is connected in the remote application but an unexpected error is thrown from the bound application.

This error is in the ERROR_CATEGORY_APP category.

Value: 3000

ERROR_CANCELLED

static val ERROR_CANCELLED: Int

The operation was cancelled. Use this error code to report that a cancellation is done after receiving a cancellation signal.

This error is in the ERROR_CATEGORY_SYSTEM category.

Value: 2001

ERROR_CATEGORY_APP

static val ERROR_CATEGORY_APP: Int

The error is caused by the app providing the function.

For example, the app crashed when the system is executing the request.

Errors in the category fall in the range 3000-3999 inclusive.

Value: 3

ERROR_CATEGORY_REQUEST_ERROR

static val ERROR_CATEGORY_REQUEST_ERROR: Int

The error is caused by the app requesting a function execution.

For example, the caller provided invalid parameters in the execution request e.g. an invalid function ID.

Errors in the category fall in the range 1000-1999 inclusive.

Value: 1

ERROR_CATEGORY_SYSTEM

static val ERROR_CATEGORY_SYSTEM: Int

The error is caused by an issue in the system.

For example, the AppFunctionService implementation is not found by the system.

Errors in the category fall in the range 2000-2999 inclusive.

Value: 2

ERROR_CATEGORY_UNKNOWN

static val ERROR_CATEGORY_UNKNOWN: Int

The error category is unknown.

This is the default value for getErrorCategory.

Value: 0

ERROR_DENIED

static val ERROR_DENIED: Int

The caller does not have the permission to execute an app function.

This error is in the ERROR_CATEGORY_REQUEST_ERROR category.

Value: 1000

ERROR_DISABLED

static val ERROR_DISABLED: Int

The caller tried to execute a disabled app function.

This error is in the ERROR_CATEGORY_REQUEST_ERROR category.

Value: 1002

ERROR_FUNCTION_NOT_FOUND

static val ERROR_FUNCTION_NOT_FOUND: Int

The caller tried to execute a function that does not exist.

This error is in the ERROR_CATEGORY_REQUEST_ERROR category.

Value: 1003

ERROR_INVALID_ARGUMENT

static val ERROR_INVALID_ARGUMENT: Int

The caller supplied invalid arguments to the execution request.

This error may be considered similar to IllegalArgumentException.

This error is in the ERROR_CATEGORY_REQUEST_ERROR category.

Value: 1001

ERROR_SYSTEM_ERROR

static val ERROR_SYSTEM_ERROR: Int

An internal unexpected error coming from the system.

This error is in the ERROR_CATEGORY_SYSTEM category.

Value: 2000

Public constructors

Public methods

describeContents

fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getErrorCategory

fun getErrorCategory(): Int

Returns the error category.

This method categorizes errors based on their underlying cause, allowing developers to implement targeted error handling and provide more informative error messages to users. It maps ranges of error codes to specific error categories.

This method returns ERROR_CATEGORY_UNKNOWN if the error code does not belong to any error category.

See android.app.appfunctions.AppFunctionException.ErrorCategory for a complete list of error categories and their corresponding error code ranges.

Return
Int Value is android.app.appfunctions.AppFunctionException#ERROR_CATEGORY_UNKNOWN, android.app.appfunctions.AppFunctionException#ERROR_CATEGORY_REQUEST_ERROR, android.app.appfunctions.AppFunctionException#ERROR_CATEGORY_APP, or android.app.appfunctions.AppFunctionException#ERROR_CATEGORY_SYSTEM

getErrorMessage

fun getErrorMessage(): String?

Returns the error message.

Return
String? This value may be null.

getExtras

fun getExtras(): Bundle

Returns any extras associated with this error.

Return
Bundle This value cannot be null.

writeToParcel

fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

static val CREATOR: Parcelable.Creator<AppFunctionException!>