onFailure

inline fun onFailure(action: (BleException) -> Unit): BleResult<T>

Performs the given action if this is a Failure.

Returns this for chaining.

result
.onSuccess { data -> saveToDatabase(data) }
.onFailure { error -> logError(error) }

Return

This BleResult for chaining.

Parameters

action

The action to perform with the error.