wrapAs

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

If the underlying Result is successful, returns it unchanged. If it failed, and the contained exception is of the specified type, returns it unchanged. Otherwise, wraps the contained exception in the specified type.

Usage: Result.wrapAs(a = ::ThrowableType)


inline fun <E : Throwable, R> Result<R>.wrapAs(a: (Throwable) -> E): Result<R>(source)

See also