pawel.barszcz
02/02/2017, 8:11 AM.map { anotherUnsafeAction() }
will be capture inside Failure
. But it’s not, you have to explicitely call Result.of { }
, eg. .flatMap { Result.of { anotherUnsafeAction() } }
2) I found it unclear for my collegaues (and me too) that Result.of { }
is captutring excepitons. I means if you look into code after month and forget that this is the way the Result
works. What I would prefer is, hmmmm, doSafely { … }
or captureExceptionsIn { … }
In other words what I have in mind is syntax for “Starting from now please capture all exceptions and let me handle them in final code block`. And yes, it’s definitely same as wrapping everything inside try { .. } catch() { … }
😛 (maybe with the difference that I want type which can be returned and continue the flow)
If I’m using Result
improperly, please, tell me 🙂 Are there alternatives which can suit my needs? Or maybe is it proper time for issue / pull request? Or time to write another lib which will suit another needs?