def retry[T](fn: => T, maxRetries: Int = 0): Try[T] = Try(fn) match {
case Failure(_) if maxRetries > 0 => retry(fn, maxRetries - 1)
case result => result
}
view raw Retry.scala hosted with ❤ by GitHub