title: rescuing from Mysql2::Error
body: <p>I have a simple question. I have a join table which has an index that ensure that (col 1, col 2) is unique.</p>
  
  <p>I am adding to that table using mysql2 gem and am trying to catch the Mysql2::Error if the attempt results in a duplicate key error. While I am getting the duplicate key error, my rescue body is not being executed. </p>
  
  <pre><code>begin
    self.foo &lt;&lt; bar
  rescue Mysql2::Error
    logger.debug("#{$!}")
  end
  </code></pre>
  
  <p>I am receiving the following error upon executing <code>self.foo &lt;&lt; bar</code></p>
  
  <p>Mysql2::Error: Duplicate entry '35455-6628' for key 'index_foos_bars_on_foo_id_and_bar_id': INSERT INTO <code>foos_bars</code> (<code>foo_id</code>, <code>bar_id</code>) VALUES (35455, 6628)</p>
  
  <p>BUT my rescue statement is not being hit! The exception is not be successfully rescued from. What am I doing wrong? If I remove Mysql2::Error and rescue for everything, then it works. But that is bad practice - I just want to rescue from Mysql2::Error which in the event of a duplicate entry.</p>
  
  <p>Thanks,</p>