EncodableResult

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class UnknownFailureException(message: String = "Unknown failure") : RuntimeException

Properties

Link copied to clipboard
Link copied to clipboard

Indicates whether the result is a failure.

Link copied to clipboard

Indicates whether the result is a success.

Link copied to clipboard

Functions

Link copied to clipboard

Applies a configuration to modify the details of the associated failure, if present. The configuration defines which exception details (e.g., stack trace, message, etc.) should be included or excluded.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun getOrDefault(defaultValue: T): T

Returns the value if it is present, otherwise returns the specified defaultValue.

Link copied to clipboard
fun getOrElse(onFailure: (WrappedException) -> T): T

Returns the value if it is present, otherwise invokes the specified function onFailure and returns its result.

Link copied to clipboard
fun getOrNull(): T?

Returns the value if it is present, otherwise returns null.

Link copied to clipboard
fun getOrThrow(): T

Throws the exception if the result is a failure and returns the result in the opposite situation.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Executes the given action if the result is a failure.

Link copied to clipboard
fun onSuccess(action: (T) -> Unit): EncodableResult<T>

Executes the given action if the result is a success.

Link copied to clipboard
fun toResult(): Result<T>

Converts the current EncodableResult instance into a Kotlin Result type. If the EncodableResult represents a success, a successful Result is returned containing the value. If the EncodableResult represents a failure, a failed Result is returned containing the exception.