Handling lots of different errors, gracefullyIs it even possible to handle them all?Sort the list of TV shows by their running timeImplementing the sorting requirementDealing with data coming from the outside worldFunctional design: Building from small blocksParsing Strings into immutable objectsParsing a List is just parsing one elementParsing a String into a TvShowWhat about potential errors?Is returning null a good idea?How do we handle potential errors more gracefully?Implementing a function that returns an OptionOption forces us to handle possible errorsBuilding from small blocksFunctional design is building from small blocksWriting a small, safe function that returns an OptionFunctions, values, and expressionsPracticing safe functions that return OptionsHow do errors propagate?Values represent errorsOption, for comprehensions, and checked exceptions ...What about checked exceptions?Conditional recoveryConditional recovery using the imperative styleConditional recovery using the functional styleChecked exceptions don’t compose—Options do!How does orElse work?Practicing functional error handlingFunctions compose, even in the presence of errorsCompiler reminds us that errors need to be coveredCompilation errors are good for us!Transforming a List of Options into a flat ListLet the compiler be our guide ...... but let’s not trust the compiler too much!Coffee break: Error-handling strategiesCoffee break explained: Error-handling strategiesTwo different error-handling strategiesAll-or-nothing error-handling strategyFolding a List of Options into an Option of a ListWe now know how to handle multiple possible errors!How to know what failedWe need to convey error details in the return valueConveying error details using EitherRefactoring to EitherReturning an Either instead of an OptionPracticing safe functions that return EitherWhat we learned about Option works with EitherCoffee break: Error handling using EitherCoffee break explained: Error handling using EitherWorking with Option/EitherSummary