recover
Recovers from a failure by providing an alternative success value.
If this is a Failure, returns a Success with the recovered value. If this is a Success, returns the same Success unchanged.
val result: BleResult<ByteArray> = connection
.readCharacteristicResult(serviceUuid, charUuid)
.recover { error ->
Log.w("BLE", "Using cached value due to: ${error.message}")
cachedValue
}Content copied to clipboard
Return
A Success with either the original or recovered value.
Parameters
recovery
The function that provides the recovery value.