Skip to content

Commit

Permalink
add @nowarn for exhaustiveness on a function I can't really comprehend
Browse files Browse the repository at this point in the history
  • Loading branch information
twrichards committed Nov 9, 2023
1 parent 0001b92 commit a70f6a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions riff-raff/app/utils/Retriable.scala
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package utils

import play.api.Logger
import scala.util.{Try, Success, Failure}
import scala.annotation.tailrec

import scala.util.{Failure, Success, Try}
import scala.annotation.{nowarn, tailrec}

trait Retriable {
def log: Logger

def retryUpTo[T](maxAttempts: Int, message: Option[String] = None)(
thunk: => T
): Try[T] = {
@nowarn // It would fail on the following inputs: Cons(), Empty
@tailrec def go(s: Stream[Try[T]], n: Int): Try[T] = s match {
case (f @ Failure(t)) #:: tail =>
val errorMessage = "Caught exception %s (attempt #%d)".format(
Expand Down

0 comments on commit a70f6a1

Please sign in to comment.