Companion

object Companion

Functions

Link copied to clipboard
fun <T> failure(exception: WrappedException, metadata: Map<String, Any?> = emptyMap()): EncodableResult<T>
fun <T> failure(exception: Throwable, metadata: Map<String, Any?> = emptyMap()): EncodableResult<T>

Creates a new EncodableResult instance representing a failure.

Link copied to clipboard
fun <T> runCatching(metadata: Map<String, Any?> = emptyMap(), block: () -> T): EncodableResult<T>

Executes the given block and captures its result or exception within an EncodableResult. If the block executes successfully, its result is encapsulated as a success. If the block throws an exception, the exception is wrapped and encapsulated as a failure.

Link copied to clipboard
fun <T> success(data: T, metadata: Map<String, Any?> = emptyMap()): EncodableResult<T>

Creates a new EncodableResult instance representing a success.