Error Handling Beyond the Standard Library
summary
Builds a signup flow that actually validates name (non‑blank), email (must contain @) and phone (starts with + and ≥4 chars), calls Retrofit and stores a token, and shows field or generic errors. Uses Kotlinx serialization, Arrow’s Validated with NonEmptyList to accumulate multiple field errors via zip merges errors, and Arrow’s Either with bind (retrofit adapter) to fail fast across the network boundary. Demo code includes value classes, a repository mapping HTTP/IO errors, and removes the pyramid of doom.
AI-written summary · about
chapters (18)
- 0:00Introduction
- 1:09Building the signup app
- 3:20Potential errors in the flow
- 6:53Happy path implementation
- 9:02Error handling strategies
- 13:26Nullable types for failure
- 14:50Moving validation elsewhere
- 16:35Introducing domain types
- 18:47Form validation and API calls
- 19:51Accumulating errors
- 24:09Arrow’s validated type
- 28:50Error accumulation with zip
- 32:46Failing fast requirement
- 35:42Pyramid of doom
- 36:03Arrow’s either type
- 38:53Backend error handling
- 41:50View model integration
- 42:12Summary of strategies
related talks
42mDesign for errors - An introduction to Domain Modeling with Arrow
41mAn Arrow to the Kotlin
46mDesign for errors - An introduction to Domain Modeling with a bit of Arrow
40mArrow of Outrageous Error Handling
54mFunctional Web APis in Practice
47mFunctional programming in Kotlin: exploring Arrow
32mFrom Exception Hell to Typed Bliss: Real-World Error Handling with Kotlin and Arrow
43mError Handling Strategies for Kotlin Programs
