From d5018a1583fafd0f92288d9174736afdf109f145 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 GitOrigin-RevId: 811ddf171794ffdf20f77de6c735ac7ac19ce30a --- 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 cb5ec1db5953..809116ec6e66 100644 --- a/python/openapi/src/com/jetbrains/python/Result.kt +++ b/python/openapi/src/com/jetbrains/python/Result.kt @@ -221,3 +221,9 @@ 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) }