Robert Klemme schrieb:
> (...)  But does the reraise_as really work as 
> expected? As far as I can see the set_backtrace is rendered useless 
> because when the secondary exception is raise the stack trace is 
> overwritten (which is quite logical btw).
 > (...)

Kernel#raise can take a backtrace as the third parameter. So reraise_as could be 
implemented as:

   class Exception
      # Raise the exception, preserving the backtrace, but as an
      # instance of class +cl+. The message is preserved by default,
      # but may be set to +msg+.
      def reraise_as(cl, msg = message)
        raise cl, msg, backtrace
      end
   end

Regards,
Pit