Episode #110: Catch And Throw

Have you ever encountered code that used exceptions for flow control? That's where code raises an exception, not to signal an error, but in order to make an early escape from a deeply nested chain of method calls.

Triggering an exception for a non-exceptional case is a kludge. Fortunately, in Ruby it's not a necessary kludge.

In this episode, you'll watch a real-world refactoring session in which I replaced an exception used for flow control with a use of Ruby's catch and throw feature.

This page is just for members. Sign in or subscribe to gain access!