Created
March 11, 2015 23:20
-
-
Save Jacoby6000/6bf910f533bb9e59628b to your computer and use it in GitHub Desktop.
This file contains 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
def someFunc(): Try[Int] = { | |
Try { | |
throw RuntimeException("Something bad happened!") | |
} | |
} | |
def callSomeFunc = { | |
val funcResult = someFunc() | |
funcResult match { | |
case Success(someIntVal) => | |
//Do successful stuff using the return value of the try | |
case Failure(e) => | |
//Handle exception | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment