Skip to main content

Error code

The asynchronous APIs provided by Vehicle SDK deliver results through onComplete and onFailed callbacks. In your app, if the Exception passed to onFailed is a VehicleException, use its errorCode property to identify the ErrorCode value. An exception passed to onFailed is not always a VehicleException.

  • onFailed signature: Get and Set APIs, checkXXXCapabilities, and VehicleListener all use the Kotlin standard Exception. ErrorCode is not passed directly as a callback argument.
  • ErrorCode definition: An enum in the ai.pleos.playground.vehicle.constant package. Vehicle SDK uses it to classify internal errors, and public APIs expose it through VehicleException.errorCode.

Use checkXXXCapabilities in advance to avoid unsupported calls. For permission errors, see Permission.

Error delivery flow​

onFailed handling example​

door.getCurrentDoorPosition(
area = DoorArea(DoorValue.ROW_1_LEFT),
onComplete = { pos -> },
onFailed = { e ->
if (e is VehicleException) {
when (e.errorCode) {
ErrorCode.ERROR_NOT_SUPPORTED_PROPERTY,
ErrorCode.ERROR_NOT_SUPPORTED_AREA -> { /* Disable the UI */ }
ErrorCode.ERROR_SECURITY_PERMISSION -> { /* Check manifest permissions */ }
ErrorCode.ERROR_SERVICE_CONNECTION_FAILURE,
ErrorCode.ERROR_INTERNAL_SERVICE -> { /* Initialize or retry */ }
else -> Log.e("Vehicle API error: ${e.errorCode} ??${e.message}")
}
} else {
Log.e("Vehicle API error: ${e.message}")
}
}
)

ErrorCode list​

ErrorCodeDescriptionRecommended action
ERROR_NOT_SUPPORTED_PROPERTYThe property or feature is not supportedDisable the UI or use an alternate flow
ERROR_NOT_SUPPORTED_AREAThe area is not supportedSelect a different area
ERROR_NOT_SUPPORTED_VALUE_TYPEThe value type is not supportedCheck the parameter and type
ERROR_SECURITY_PERMISSIONInsufficient permissionCheck Permission and @RequiresPermission
ERROR_SERVICE_CONNECTION_FAILUREFailed to connect to Vehicle ServiceCheck initialize() and the emulator state
ERROR_INTERNAL_SERVICEInternal service errorRetry or notify the user of a temporary error
ERROR_DRIVING_RESTRICTEDThe feature is restricted while drivingInform the user of the driving restriction
ERROR_EMPTY_RESULTNo result was returnedShow an empty state in the UI
ERROR_UNDEFINEDUndefined errorLog the error and retry