title: Passing multiple error classes to ruby's rescue clause in a DRY fashion
body: <p>I have some code that needs to rescue multiple types of exceptions in ruby:</p>
  
  <pre><code>begin
    a = rand
    if a &gt; 0.5
      raise FooException
    else
      raise BarException
    end
  rescue FooException, BarException
    puts "rescued!"
  end
  </code></pre>
  
  <p>What I'd like to do is somehow store the list of exception types that I want to rescue somewhere and pass those types to the rescue clause:</p>
  
  <pre><code>EXCEPTIONS = [FooException, BarException]
  </code></pre>
  
  <p>and then:</p>
  
  <pre><code>rescue EXCEPTIONS
  </code></pre>
  
  <p>Is this even possible, and is it possible without some really hack-y calls to <code>eval</code>? I'm not hopeful given that I'm seeing <code>TypeError: class or module required for rescue clause</code> when I attempt the above. </p>