title: DRY way of re-raising same set of exceptions in multiple places
body: <p>short:</p>
  
  <p>Is there a way in Ruby to DRY-ify this:</p>
  
  <pre><code>def entry_point_one
    begin
      do_something
    rescue MySyntaxErrorOne, MySyntaxErrorTwo, MySyntaxErrorEtc =&gt; syn_err
      raise syn_err.exception(syn_err.message)
    end
  end
  
  def entry_point_two
    begin
      do_something_else
    rescue MySyntaxErrorOne, MySyntaxErrorTwo, MySyntaxErrorEtc =&gt; syn_err
      raise syn_err.exception(syn_err.message)
    end
  end
  </code></pre>
  
  <p>longer:</p>
  
  <p>I'm building an interpreter. This interpreter can be called using different entry points. If I feed this interpreter a 'dirty' string, I expect it to raise an error. However, it would be nice if I don't get spammed by the by the entire back trace of every method called directly or indirectly by do_something, especially since the interpreter makes use of recursion.</p>
  
  <p>As you can see in the above snippet, I already know a way to re raise an error and thereby removing the back trace. What I would like do is remove the duplication in the above example. The closest I have come thus far is this:</p>
  
  <pre><code>def entry_point_one
    re_raise_known_exceptions {do_something}
  end
  
  def entry_point_two
    re_raise_known_exceptions {do_something_else}
  end
  
  def re_raise_known_exceptions
    yield
  rescue MySyntaxErrorOne, MySyntaxErrorTwo, MySyntaxErrorEtc =&gt; syn_err
      raise syn_err.exception(syn_err.message)
  end
  </code></pre>
  
  <p>But that makes the method re-raise-known-exceptions show up in the back trace.</p>
  
  <p>edit: I guess what I want would be something like a C pre-processing macro</p>