From ed0fda649a49b8cd2ee51a7a331f6c59d5897d37 Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Thu, 13 Nov 2025 23:45:35 +0100 Subject: [PATCH] [python]: PY-85585 : (WIP) Introduce method to map errors Utility method to map `Result`` into `Result`` is required for the next changes (cherry picked from commit 811ddf171794ffdf20f77de6c735ac7ac19ce30a) GitOrigin-RevId: b13ddca080644357a738ffc10795703d11b18d97 --- python/openapi/src/com/jetbrains/python/Result.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/openapi/src/com/jetbrains/python/Result.kt b/python/openapi/src/com/jetbrains/python/Result.kt index bd84937b508a..9190f0aec86e 100644 --- a/python/openapi/src/com/jetbrains/python/Result.kt +++ b/python/openapi/src/com/jetbrains/python/Result.kt @@ -186,3 +186,9 @@ val Result.isFailure: Boolean get() = this is Failure val Result.isSuccess: Boolean get() = this is Success fun Result.getOrThrow(): S = orThrow() + +/** + * See [Result.mapSuccess] + */ +inline fun Iterable>.mapError(code: (E) -> E2): List> = + map { it.mapError(code) }