Skip to main content

Error code

Async Vehicle APIs deliver results through onComplete and onFailed callbacks. In your app, when the Exception received in onFailed is a VehicleException, check the ErrorCode value via errorCode. Not every onFailed callback will receive a VehicleException.

  • onFailed signature: Get/Set APIs, checkXXXCapabilities, and VehicleListener all use Kotlin’s standard Exception. ErrorCode is not passed directly as a callback argument.
  • ErrorCode definition: enum in the ai.pleos.playground.vehicle.constant package. Used inside the Vehicle SDK for error classification; exposed in the public API via VehicleException.errorCode.

Use checkXXXCapabilities upfront to reduce unsupported calls, and see Permission for permission errors.

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 UI */ }
ErrorCode.ERROR_SECURITY_PERMISSION -> { /* check manifest permissions */ }
ErrorCode.ERROR_SERVICE_CONNECTION_FAILURE,
ErrorCode.ERROR_INTERNAL_SERVICE -> { /* initialize·retry */ }
else -> Log.e("Vehicle API error: ${e.errorCode}${e.message}")
}
} else {
Log.e("Vehicle API error: ${e.message}")
}
}
)

ErrorCode reference

ErrorCodeDescriptionRecommended handling
ERROR_NOT_SUPPORTED_PROPERTYProperty (feature) not supportedDisable UI or alternate flow
ERROR_NOT_SUPPORTED_AREAArea not supportedChange area selection
ERROR_NOT_SUPPORTED_VALUE_TYPEUnsupported value typeRe-check parameters and types
ERROR_SECURITY_PERMISSIONMissing permissionPermission·@RequiresPermission
ERROR_SERVICE_CONNECTION_FAILUREVehicle service connection failedinitialize()·emulator state
ERROR_INTERNAL_SERVICEInternal service errorRetry·temporary error message
ERROR_DRIVING_RESTRICTEDRestricted while drivingDriving restriction notice
ERROR_EMPTY_RESULTEmpty resultEmpty-state UI
ERROR_UNDEFINEDUndefined errorLog·retry