Exceptional Ruby
summary
Deep dive into Ruby exceptions: explains raise internals (four steps, .exception coercion, $! backtrace handling), shows quirks (rescue only catches StandardError, ensure with explicit return swallows exceptions), demos that were built (hammer_time gem interactive error console) and patterns that scale (nested exceptions, module tagging of bubbled errors, atexit logging of gem versions, circuit‑breaker cautionary tale), and recommends structuring errors as three exception classes (user, logic, transient) with contingency methods and verifiable exception‑safety levels.
AI-written summary · about
chapters (54)
- 0:00Intro
- 0:29What is a failure?
- 1:42The Definition of Failure cont'd
- 1:59Lifecycle of an Exception
- 2:10Raising Exceptions
- 3:06raise with a string
- 3:17raise with a custom backtrace
- 3:37raise is a method on Kernel
- 3:53Overriding raise
- 4:12Hammertime
- 4:43raise internals
- 6:16Implement your own #exception()
- 6:52set backtrace
- 7:50Throw it up the call stack
- 8:06rescue with no arguments
- 8:41rescue with a class
- 9:05rescue with a dynamic matcher
- 11:18raise during exception handling
- 11:28raise a new error
- 12:00Nested Exceptions
- 12:38Re-raise with the caught error
- 13:18Re-raise with message, backtrace
- 13:36Disallowing double-raise
- 14:37Using NoDoubleRaise
- 14:53Uncaught exceptions
- 15:27A simple crash logger
- 16:20Responding to Failures
- 16:36Return an error value
- 16:48Return a benign value
- 17:09Remote Failure Reporting
- 19:21Avoid the failure cascade
- 19:40Your Failure Handling Strategy
- 20:23Question #1
- 21:31Use throw for expected cases
- 22:55Question #2
- 23:52What constitutes an exception?
- 24:37Caller-defined fallback strategy
- 25:52Question #4
- 27:00Isolate exception handling code
- 27:26begin is a code smell
- 27:54Method-level exception clauses
- 28:31Contingency methods
- 29:12When you least expect it
- 30:01Exception Safety
- 30:28The Three Guarantees
- 31:44Be specific when eating exceptions
- 32:33Tag your library exceptions
- 33:56What exception classes do I need?
- 35:07User Error
- 35:27Logic Error
- 35:43Transient Error
- 36:15Three essential exception classes
- 36:53A Recap
- 37:08Thank You!
related talks
42mExceptional Ruby
37mException Handling Designing Robust Software
25mThings You Didn't Know About Exceptions
30mRuby on Fails: effective error handling with...
39mSteal This Talk: The Best Features Ruby Doesn't Have (Yet)
38mSpelunking in Ruby
29mThe Dark Side of Ruby
29mRuby Monsters Go Bump in the NIght
