Hello, Is there any way to break sequence in the m...
# getting-started
k
Hello, Is there any way to break sequence in the middle if error occurred?
Code.kt
This code seems not working, and line 10 seems no effect on the chain 🤔
y
I think instead you want something like
Sequence<Either<Error, Entity>>
k
But at the end I would like have single either of things instead list of things. Is there a way to achieve that?
d
Have you looked at
runCatching
?
it returns a Result<T>, which can contain a T or an exception.
k
I don’t see how the
runCatching
would help me. For now as a workaround I just finish one sequence with
.toList()
and in second function start another sequence.