~/talk

Using Monads for Elegant Error Handling

Talkat RubyConf 2021 · 2021-11-08..11-10· [ruby, developer-experience]
slides:none on file

Argues that replacing rescue-and-nil patterns with a dry-monads result type (concrete Success/Failure values) makes error flow explicit, keeps exceptions for later logging (Airbrake/New Relic), and composes via a fmap/or pipeline so Faraday/Rails API calls propagate failures without hidden nils. Shows exact code: wrapping responses, using value! only after success, chaining fmaps, and or for error handlers. Notes costs: more boilerplate, an extra gem, and a steeper team learning curve.

AI-written summary · about

  1. 0:00Start
  2. 9:57Consistent interface
  3. 10:17Refactor to Monads
  4. 14:33Convert to pipeline
  5. 15:45Handle failure with or
  6. 19:52Turn it up to eleven!
  7. 23:18Quiz
~/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.