~/talk

Designing for Errors in a Kotlin-first SDK:When to throw, nullify, or return a Result.

Talkat Droidcon London 2023 · 2023-10-26..10-27· [kotlin]
links:none on file
slides:none on file

The Kotlin-first SDK migration revisits error strategy across about 2,000 functions built atop a C++ core with JNI and finds three actionable patterns: throw and annotate with @Throws for preventable logic errors; use sealed-result shapes for recoverable domain errors but prefer a returned Result to avoid breaking changes when native layers may add new error cases; and use nullable/boolean/empty-collection returns (with orNull/try naming) for lenient errors. Suspend functions mostly return Result for I/O, properties avoid throwing, and constructors use factories when nontrivial failure handling is needed.

AI-written summary · about

  1. 0:00Introduction
  2. 1:07Why error design matters
  3. 2:31Kotlin error propagation
  4. 4:55Domain-specific errors
  5. 7:21Lenient error handling
  6. 10:54Case study and constraints
  7. 14:43Suspend functions and properties
  8. 16:11Summary and resources
  9. 16:33Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.