rethrow

inline fun rethrow(throwable: Throwable): Nothing

Syntax-sugar for a lambda that throws it (provided it is a Throwable).

fun <T> T.map(transform: (T) -> T): T

// Before:
map(transform = { throw it })

// After:
map(transform = ::rethrow)

Throws

passed as the first argument to the lambda.


inline fun <T : Any> rethrow(collector: FlowCollector<T>, throwable: Throwable): Nothing

Syntax-sugar for a lambda that throws it (provided it is a Throwable) within a FlowCollector context.

Throws

passed as the first argument to the lambda.