Sometimes it’s hard to decide how to handle a failure in a method call. Raise an exception? Return a nil? Log an error? The best choice may differ depending on where the method is being called. In today’s free RubyTapas episode, we look at a technique for deferring the decision about how to deal with a failure to the point when a method is called.

[boilerplate bypath=”rubytapas-sample”]

Published by Avdi Grimm

3 Comments

  1. This was very useful!

    Reply
  2. […] implementation was inspired by Avdi Grimm’s Ruby Tapas screencast Caller-specified Fallback Handler. A slightly more in-depth treatment can be found in Avdi Grimm’s Confident […]

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *