API reference

DisplayError Enum

Errors that can occur during display operations on a wearable device.
These errors are returned via DatResult from display operations such as Display.sendContent and Display.clearDisplay. Handle errors by inspecting the failure result:
display.sendContent {
    flexBox { text("Hello") }
}.onFailure { error ->
    when (error) {
        DisplayError.DEVICE_DISCONNECTED -> showReconnectPrompt()
        DisplayError.INVALID_SESSION_STATE -> restartDisplay()
        DisplayError.RENDERING_FAILED -> showRenderError()
        DisplayError.UNEXPECTED_ERROR -> showGenericError()
    }
}

See Also

Signature

enum DisplayError : Enum<DisplayError> , DatError

Enumeration Constants

MemberDescription
DEVICE_DISCONNECTED
Device is not connected or became disconnected during the operation.
INVALID_SESSION_STATE
The display capability is not in the required state for the requested operation.
RENDERING_FAILED
Failed to render display content on the wearable device.
UNEXPECTED_ERROR
An unexpected error occurred during the display operation.

Properties

description : String
[Get]
A human-readable description of the error suitable for logging and debugging purposes.
Signature
open override val description: String

Methods

getLocalizedDescription ( context )
Returns a localized description of the error using Android string resources when available.
Signature
open override fun getLocalizedDescription(context: Context?): String
Parameters
context: Context?  Optional Android context for accessing string resources. If null or if no localized string is available, returns the default DisplayError.description.
Returns
String  The localized error description, or the default description if localization unavailable.