small medium large xlarge

16 Feb 2009, 07:00
Javid Jamae (2 posts)

On page 119 of B1.10 printing (Iteration C3: Handling Errors), there is a section that reads:

bq. This code uses a little-known feature of Ruby’s exception handling. The else clause invokes the code that follows only if no exception is raised. It allows us to specify one path through the action if the exception is raised and another if it isn’t.

But, there is no else clause in the add_to_cart method in depot_h/app/controllers/store_controller.rb. I thought that perhaps what was meant was the “rescue” clause, not the “else” clause, but even with substituting the word “rescue” in, the description above still not seem to make sense. Am I missing something, or is this a problem with the text?

You must be logged in to comment