mapFailure
Returns a Result whose failure exception is replaced by the result of transform, or the original success.
The failure-side counterpart of Result.map, typically used to wrap low-level exceptions into domain-specific ones. Exceptions thrown by transform are not caught.
val user = fetchUser(id).mapFailure { UserLoadException(id, cause = it) }Content copied to clipboard
Return
this success unchanged, or a failure holding the transformed exception.
Parameters
transform
mapping from the current exception to its replacement.