In this talk, we’ll explore how Java’s exception model works, how Kotlin has adapted and evolved it, and which other “organic” approaches, such as using Result, Optional, two return values, or sealed hierarchies, have gained traction for signaling errors in recent years. We’ll also look at other programming ecosystems to see what we can learn from their successes and trade-offs. We'll also look at how error handling is approached in different domains, such as Spring and Android.
From there, we’ll dive into Kotlin’s ongoing exploration of a new error model: Rich Errors. The core idea is to treat errors as values. Similar to Kotlin’s nullability system, where null is a special value, Rich Errors extend the model to allow declaring “error values” that are integrated into the type system. We’ll discuss the design principles, potential benefits, and how leverage Kotlin's flow typing to work with errors.