Error Handling Strategies for Kotlin Programs
summary
Compares actual techniques and when teams switch: uses snorcher fuzzing to validate which exceptions parsers actually throw; shows converting exceptions to nullable returns for simple parsers and to a small sealed Result type for typed error handling across batch vs single-request contexts; implements an inline operator trick to early-return from lambdas and contrasts that with Arrow coroutines for cleaner monadic code; reports that moving error-prone IO to outer layers and keeping small per-context error hierarchies prevents surprising 500 storms and rollbacks.
AI-written summary · about
chapters (8)
- 0:00Start
- 0:10Failure is not an Option Error handling strategies for Kotlin programs Nat Pryce & Duncan McGregor
- 2:21Error handling is hard to get right
- 18:41Total Functions
- 29:07An example Result type
- 30:49Convenience operations instead of when expressions
- 35:07Flatten nesting with inline functions & early returns
- 36:33How to model error reasons in the Failure case?
related talks
17mA closer look into error handling techniques
17mDesigning for Errors in a Kotlin-first SDK:When to throw, nullify, or return a Result.
32mFrom Exception Hell to Typed Bliss: Real-World Error Handling with Kotlin and Arrow
37mHow Kotlin Lets Us Remove Exceptions from Our Code
43mFunctional Error Handling
47mFunctional programming in Kotlin: exploring Arrow
48mKotlin & Functional Programming: pick the best, skip the rest
39mA Result for Our Issues
