[python]: PY-85585 : (WIP) Introduce method to map errors

Utility method to map `Result<S, E>`` into `Result<S, E2>`` is required for the next changes

GitOrigin-RevId: 811ddf171794ffdf20f77de6c735ac7ac19ce30a
This commit is contained in:
Ilya.Kazakevich
2025-11-14 00:16:38 +00:00
committed by intellij-monorepo-bot
parent 2a944c0839
commit d5018a1583
@@ -221,3 +221,9 @@ val <S, E> Result<S, E>.isSuccess: Boolean get() = this is Success
*/
fun <S, E> Result<S, E>.getOrThrow(): S = orThrow()
/**
* See [Result.mapSuccess]
*/
inline fun <S, E, E2> Iterable<Result<S, E>>.mapError(code: (E) -> E2): List<Result<S, E2>> =
map { it.mapError(code) }