Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Handle error throws in future, return default value on error
- */
- def recover(): Unit = {
- val f: Future[String] = downloadBlob("ftp://blobs/8671").recover {
- case e =>
- println(s"fail download, ${e.getMessage}")
- "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