Created
February 2, 2017 15:38
-
-
Save ludflu/f6339c2c64b5cbde13c40a766b995372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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