onFailure

inline fun <T> ChannelResult<T>.onFailure(action: (exception: Throwable?) -> Unit): ChannelResult<T>(source)

Performs the given action if the operation failed. The result of ChannelResult.exceptionOrNull is passed to the action parameter.

Returns the original ChannelResult unchanged.

A shorthand for this.also { if (isFailure) action(exceptionOrNull()) }.