mapError

inline fun mapError(transform: (BleException) -> BleException): BleResult<T>

Transforms the error using the given transform function.

If this is a Failure, returns a new Failure with the transformed error. If this is a Success, returns the same Success unchanged.

val result = operation()
.mapError { error ->
BleConnectionException("Wrapped: ${error.message}", error.gattStatus)
}

Return

A new BleResult with the transformed error, or the original success.

Parameters

transform

The function to apply to the error.