I have a situation where I need to run a bunch of operations in parallel.
All operations have the same return value (say a Seq[String]
).
Its possible that some of the operations may fail, and others successfully return results.
I want to return both the successful results, and any exceptions that happened, so I can log them for debugging.
Is there a built-in way, or easy way through any library (cats/scalaz) to do this, before I go and write my own class for doing this?
I was thinking of doing each operation in its own future, then checking each future, and returning a tuple of Seq[String] -> Seq[Throwable]
where left value is the successful results (flattened / combined) and right is a list of any exceptions that occurred.
Is there a better way?