Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Execute another future operation on failure
- */
- def recoverWith(): Unit = {
- val f: Future[String] = downloadBlob("ftp://blobs/8671").recoverWith {
- case e =>
- println(s"fail download, ${e.getMessage}")
- Future {
- "empty blob"
- }
- }
- println(Await.result(f, 10.seconds))
- }
- /*
- * output
- fail download, invalid uri
- empty blob
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement