September 2014
Intermediate to advanced
240 pages
7h 2m
English
Sometimes an error condition is bad enough that it seems flat-out rude to return nil from a method. When things get this mucked up it’s best to unwind the stack and provide details describing the failure.
Purists (of which I’m a card-carrying member) believe that exceptions should rarely be used...mostly to give a meaningful apology to the user (followed promptly by crashing the program and discarding all her hard work).
Ruby programmers tend to be more liberal with exceptions. A number of routine error conditions are encoded into standard exception classes and used to report specific failures. Fortunately, the most common exception classes contain enough information that it’s practical to rescue the exception and recover from the ...