result.fold(
onSuccess = { photoData -> displayPhoto(photoData) },
onFailure = { error, _ ->
when (error) {
is CaptureError.DeviceDisconnected -> showDeviceError()
is CaptureError.NotStreaming -> showStreamingRequired()
is CaptureError.CaptureInProgress -> showBusyMessage()
is CaptureError.CaptureFailed -> showCaptureError()
}
}
)
interface CaptureError : DatError
description
: String
[Get] |
A human-readable description of the error suitable for logging and debugging purposes.
Signature
abstract val description: String |
getLocalizedDescription
(
context
)
|
Returns a localized description of the error using Android string resources when available.
Signature
abstract 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 DatError.description.
Returns String
The localized error description, or the default description if localization unavailable.
|
toException
()
|
Converts this error to an exception for use with legacy APIs.
Signature
open fun toException(): Exception |
data object DeviceDisconnected : CaptureError
description
: String
[Get] |
A human-readable description of the error suitable for logging and debugging purposes.
Signature
open override val description: String |
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 CaptureError.DeviceDisconnected.description.
Returns String
The localized error description, or the default description if localization unavailable.
|
toException
()
|
Converts this error to an exception for use with legacy APIs.
Signature
open fun toException(): Exception |
data object NotStreaming : CaptureError
description
: String
[Get] |
A human-readable description of the error suitable for logging and debugging purposes.
Signature
open override val description: String |
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 CaptureError.NotStreaming.description.
Returns String
The localized error description, or the default description if localization unavailable.
|
toException
()
|
Converts this error to an exception for use with legacy APIs.
Signature
open fun toException(): Exception |
data object CaptureInProgress : CaptureError
description
: String
[Get] |
A human-readable description of the error suitable for logging and debugging purposes.
Signature
open override val description: String |
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 CaptureError.CaptureInProgress.description.
Returns String
The localized error description, or the default description if localization unavailable.
|
toException
()
|
Converts this error to an exception for use with legacy APIs.
Signature
open fun toException(): Exception |
data object CaptureFailed : CaptureError
description
: String
[Get] |
A human-readable description of the error suitable for logging and debugging purposes.
Signature
open override val description: String |
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 CaptureError.CaptureFailed.description.
Returns String
The localized error description, or the default description if localization unavailable.
|
toException
()
|
Converts this error to an exception for use with legacy APIs.
Signature
open fun toException(): Exception |