failureOf

inline fun <Error : Any> failureOf(block: () -> Error): Failure<Error>

Builds a Failure outcome with the error provided by the block.

Return

A Failure instance containing the error returned by the block.

Parameters

Error

The error type of the Failure, which must be a subtype of Any.

block

The block that provides the error for the failure outcome.


inline fun <In, Out : Any, Error : Any> In.failureOf(block: (In) -> Error): Failure<Error>

Builds a Failure outcome with the error provided by the block.

Receiver

Some input type, In, passed to block.

Return

A Failure instance containing the error returned by the block.

Parameters

Out

The output type of the block, which must be a subtype of Any.

block

The block that provides the error for the failure outcome.