mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[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:
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) }
|
||||
|
||||
Reference in New Issue
Block a user