runCatchingSuspend

inline suspend fun <R> runCatchingSuspend(crossinline block: suspend () -> R): Result<R>

Author

skydoves (Jaewoong Eum)

Since

1.0.1

Calls the specified suspend function block and returns its encapsulated result if invocation was successful, catching any Throwable exception that was thrown from the suspend block function execution and encapsulating it as a failure.

Parameters

block

Returns its encapsulated result if invocation was successful,


inline suspend fun <T, R> T.runCatchingSuspend(crossinline block: suspend T.() -> R): Result<R>

Author

skydoves (Jaewoong Eum)

Since

1.0.1

Calls the specified suspend function block with this value as its receiver and returns its encapsulated result if invocation was successful, catching any Throwable exception that was thrown from the block function execution and encapsulating it as a failure.

Parameters

block

Returns its encapsulated result if invocation was successful,