~/talk

Exceptional Ruby

Talkat RubyConf 2011 · 2011-09-29..10-01· [ruby, software-architecture]
slides:none on file

Explains Ruby’s actual raise lifecycle: Ruby calls an object’s exception.exception coercion, then calls set_backtrace, sets the global $! error variable, and unwinds the stack; shows how to override raise and demos the Hammer Time Jam interactive error console. Demonstrates retry, nested exceptions (carry original via an attribute), using at_exit for crash logging, advocating circuit-breakers and contingency methods, and recommends structuring libraries around three classes — user error, logic error, transient error — so callers can choose handling semantics.

AI-written summary · about

  1. 0:00Intro
  2. 2:11Lifecycle of an Exception
  3. 2:23Raising Exceptions
  4. 3:15raise with a string
  5. 3:48raise is a method on Kernel
  6. 4:02Overriding raise
  7. 4:42raise internals
  8. 5:04Get the exception object
  9. 5:35exception()
  10. 5:52Implement your own #exception
  11. 6:32Set the backtrace
  12. 6:42Set global error variable
  13. 7:35Unwind the call stack
  14. 7:49rescue with no arguments
  15. 8:18rescue with just a name
  16. 8:40rescue with a class
  17. 9:18rescue with a dynamic matcher
  18. 10:23ensure with explicit return
  19. 10:43retry
  20. 11:46raise during exception handling
  21. 13:48Re-raise with new message
  22. 14:14Failures without context
  23. 14:48Adding context
  24. 16:03Re-raise with message, backtrace
  25. 16:15Re-raise with no arguments
  26. 17:30Uncaught exceptions
  27. 18:04A simple crash logger
  28. 18:58Responding to Failures
  29. 19:15Return an error value
  30. 19:27Return a benign value
  31. 19:59Remote Failure Reporting
  32. 22:20Avoid the failure cascade
  33. 22:40Your Failure Handling Strategy
  34. 23:04Question #1
  35. 25:24Question #2
  36. 26:06What constitutes an exception?
  37. 26:57Caller-defined fallback strategy
  38. 28:02Question #4
  39. 29:41Isolate exception handling code
  40. 29:53begin is a code smell
  41. 30:39Method-level exception clauses
  42. 31:33Contingency methods
  43. 33:01Exception Safety
  44. 33:27The Three Guarantees
  45. 35:50Tag your library exceptions
  46. 39:27User Error
  47. 39:53Logic Error
  48. 40:04Transient Error
  49. 40:33Three essential exception classes
  50. 40:55A Recap
~/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.