Reconciling Functional Programming And Exceptions
summary
Argues for returning Try/Either (or Scalaz disjunction) instead of throwing exceptions, shows examples with map/flatMap, recover and for-comprehensions, and warns about nested Try and Option needing monad transformers; recommends stricter parameter types to move errors to compile time; stresses log every failure and decouple reporting from recovery, and shows a reusable handler that trims stack frames and auto-logs; notes JVM interop pain with Java checked/unchecked exceptions and anonymous-function stack traces and points to tools like rapture and stacktrace cleaners.
AI-written summary · about
chapters (16)
- 0:00Introduction and context
- 1:22Why exceptions matter
- 3:30Functional vs imperative error handling
- 5:36Using Try type in Scala
- 7:45Chaining Try operations
- 9:09Monads and Try limitations
- 10:14Logging exceptions properly
- 11:40Alternatives to Try
- 13:07Replacing exceptions with types
- 14:30Functional core with imperative shell
- 15:54Java exceptions in Scala
- 17:19Handling Java exceptions
- 18:23Better exception logging tools
- 19:30Clarifying exception terminology
- 20:56Exception handling patterns
- 23:08Final recommendations and summary
