40 Error handling with Try

 

After reading this lesson, you will be able to

  • Represent a computation that can fail using Try
  • Decompose it using pattern matching
  • Manipulate its value using the map, flatten, and flatMap operations
  • Chain several Try instances using for-comprehension
  • Check if a computation has failed and retrieve its value
 

40.1 Creating a Try

 
 
 

40.2 Pattern matching on Try

 
 

40.3 The map, flatten, and flatMap operations

 
 
 

40.3.1 The map function

 
 

40.3.2 The flatten function

 
 

40.3.3 The flatMap function

 
 

40.4 For-comprehension

 
 

40.5 Other operations on Try

 
 
 

Summary

 
 

Answers to quick checks

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest