Package-level declarations

Functions

Link copied to clipboard
inline fun <T> catchingUnwrapped(block: () -> T): Result<T>

Non-fatal-only-catching version of stdlib's runCatching, returning a Result -- Re-throws any fatal exceptions, such as OutOfMemoryError. Re-implements Arrow's nonFatalOrThrow logic to avoid a dependency on Arrow for a single function.

Link copied to clipboard
inline fun <T, R> T.catchingUnwrapped(block: T.() -> R): Result<R>
Link copied to clipboard
actual inline fun Throwable.nonFatalOrThrow(): Throwable
expect inline fun Throwable.nonFatalOrThrow(): Throwable
actual inline fun Throwable.nonFatalOrThrow(): Throwable
Link copied to clipboard
inline fun <E : Throwable, T> runWrappingAs(a: (Throwable) -> E, block: () -> T): T

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

Runs the block. If any non-fatal exception is thrown, ensure that it is of the provided type.

Link copied to clipboard
inline fun <E : Throwable, R> Result<R>.wrapAs(a: (Throwable) -> E): Result<R>

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

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.