title: How do I add information to an exception message in Ruby?
body: <p>How do I add information to an exception message without changing its class in ruby?</p>
  
  <p>The approach I'm currently using is</p>
  
  <pre><code>strings.each_with_index do |string, i|
    begin
      do_risky_operation(string)
    rescue
      raise $!.class, "Problem with string number #{i}: #{$!}"
    end
  end
  </code></pre>
  
  <p>Ideally, I would also like to preserve the backtrace.</p>
  
  <p>Is there a better way?</p>