catchingUnwrappedAs

inline fun <E : Throwable, T> catchingUnwrappedAs(a: (String?, Throwable) -> E, block: () -> T): Result<T>(source)

Runs the specified function block, returning a Result. Any non-fatal exception will be wrapped as the specified exception, unless it is already the specified type.

Usage: catchingUnwrappedAs(type = ::ThrowableType) { block }.


inline fun <E : Throwable, T, R> R.catchingUnwrappedAs(a: (String?, Throwable) -> E, block: R.() -> T): Result<T>(source)
inline fun <E : Throwable, T> catchingUnwrappedAs(a: (Throwable) -> E, block: () -> T): Result<T>(source)
inline fun <E : Throwable, T, R> R.catchingUnwrappedAs(a: (Throwable) -> E, block: R.() -> T): Result<T>(source)

See also