getOrThrow

fun getOrThrow(): T

Returns the success value if this is a Success, or throws the exception if this is a Failure.

Use this method when you want to propagate failures as exceptions.

try {
val data = result.getOrThrow()
processData(data)
} catch (e: BleException) {
handleError(e)
}

Return

The success value.

Throws

If this is a Failure.