BackupActionResult


sealed class BackupActionResult

Known direct subclasses
BackupActionResult.Failure

Indicates that the device payload failed during execution or verification.

BackupActionResult.Success

Indicates that the device payload executed and verified successfully.


Represents the result of a delegated device payload execution.

Note: This sealed class is open to future additions. Consumers should use a non-exhaustive 'when' pattern-matching approach (incorporating an explicit 'else' branch) to ensure binary compatibility when new subclasses are introduced.

Summary

Nested types

Indicates that the device payload failed during execution or verification.

Indicates that the device payload executed and verified successfully.

Protected constructors

Public functions

Map<String, String>

Returns the data of a Success, or throws an IOException for a Failure, as BackupRestoreController.runBackupRestoreFlow does when one of its actions fails.

Public properties

abstract Map<String, String>

Data that the action returned, such as values it read on the device.

Boolean

Returns true if this is a Success result.

Protected constructors

BackupActionResult

protected BackupActionResult()

Public functions

getOrThrow

Added in 1.0.0-alpha04
fun getOrThrow(): Map<String, String>

Returns the data of a Success, or throws an IOException for a Failure, as BackupRestoreController.runBackupRestoreFlow does when one of its actions fails.

The exception message has the Failure.errorMessage and the Failure.stackTrace that the device sent. To read a Failure itself, such as its data, check the type of this result instead.

Throws
IOException

if this is a Failure

Public properties

data

Added in 1.0.0-alpha04
abstract val data: Map<String, String>

Data that the action returned, such as values it read on the device. Empty if the action returned none or didn't run to completion. The data of a Failure leaves out the status and error of the action, which Failure.errorMessage reports. A result keeps a copy of the data that it's created with.

isSuccess

Added in 1.0.0-alpha04
val isSuccess: Boolean

Returns true if this is a Success result.