Exceptional Ruby
summary
Explains concrete behaviors and tools: raise and fail are synonyms and raising follows a four-step raise process (build exception object, set backtrace, set $!, throw). Demonstrates a hammer_time gem error console, shows nested-exception pattern to preserve originals, outlines a circuit-breaker to avoid failure cascades, gives a crash-logger using at_exit, describes a retry use and an exception-safety test harness that records external calls and replays them to force failures.
AI-written summary · about
chapters (52)
- 0:00Intro
- 0:47What is a failure?
- 2:23The Definition of Failure cont'd
- 2:40Lifecycle of an Exception
- 2:54Raising Exceptions
- 3:45raise with no arguments
- 3:56raise with an error class
- 4:17raise is a method on Kernel
- 4:31Overriding raise
- 4:48Hammertime
- 5:17raise internals
- 6:34Implement your own #exception()
- 7:04set backtrace
- 7:19Set $!
- 8:09Throw it up the call stack
- 8:33rescue with no arguments
- 8:52rescue with a class
- 9:02rescue with a dynamic matcher
- 10:47ensure with explicit return
- 11:16retry
- 11:48raise during exception handling
- 12:00raise a new error
- 12:32Nested Exceptions
- 13:10Re-raise with the caught error
- 13:26Re-raise with new message
- 15:32Uncaught exceptions
- 15:51A simple crash logger
- 17:05Return an error value
- 17:32Return a benign value
- 18:06Remote Failure Reporting
- 20:09Avoid the failure cascade
- 21:06Your Failure Handling Strategy
- 21:29Exceptions shouldn't be expected
- 22:09A rule of thumb for raising
- 23:03Use throw for expected cases
- 23:57What constitutes an exception?
- 24:47Caller-defined failure strategy
- 26:03Questions before raising
- 26:36Question #4
- 29:11Isolate exception handling code
- 29:39begin is a code smell
- 30:23Method-level exception clauses
- 31:18Contingency methods
- 32:07Exception Safety
- 33:07The Three Guarantees
- 33:59When you least expect it
- 35:04Exception testing
- 35:40Code Under Test
- 37:47Be specific when eating exceptions
- 38:27Define your own error base class
- 39:02What exception classes do I need?
- 39:12A Recap








