Skip to content

Instantly share code, notes, and snippets.

@ludflu
Created February 2, 2017 15:38
Show Gist options
  • Select an option

  • Save ludflu/f6339c2c64b5cbde13c40a766b995372 to your computer and use it in GitHub Desktop.

Select an option

Save ludflu/f6339c2c64b5cbde13c40a766b995372 to your computer and use it in GitHub Desktop.
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
/**
* Created by jsnavely on 1/30/17.
*/
object DefaultedErrorHandlerExample {
def handleError(throwable: Throwable): Unit = {
println(throwable.getMessage)
}
def noOp(throwable: Throwable): Unit = {
}
def storeNode(test:String, handler :(Throwable) => Unit = noOp) : String = {
Future{
throw new Throwable("a terrible mistake has been made")
} onFailure {
case t => handler(t)
}
test
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment