Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement