Retry a function that returns a Future
问题 Suppose I've got a function foo that performs asynchronous computation and returns a Future : def foo(x: Int)(implicit ec: ExecutionContext): Future[Int] = ??? Now I'd like to retry this computation n times until the computation succeeds. def retryFoo(x: Int, n: Int)(implicit ec: ExecutionContext): Future[Int] = ??? I would like also to return all exceptions thrown while retrying. So, I define new exception class ExceptionsList and require retryFoo to return ExceptionsList when all retries