So far, we focused on ensuring that the body of a Scala function does what it's supposed to and doesn't do anything else (that is, an error or exception). Now, in order to make use of any programming and to avoid producing error-prone code then you need to know how to catch exceptions and handle errors in this language. We will see how to extend higher-order functions outside collections using some special features of Scala such as Try, Either, and Future.
Error handling in functional Scala
Failure and exceptions in Scala
At first, let's define what we mean by failures in general (source: https://tersesystems.com/2012/12/27/error-handling-in-scala/):
- Unexpected internal failure: The operation fails as the result...