rails/web-console — pull request #51 by gsamokovarov (2014-09-21 18:45:52+00:00)
Title: Overhaul of the Exception monkey patch and JRuby support

Previously we used the same code as Better Error, changed slightly to
not collide with Better Errors' monkey patch. However, this caused bugs
like charliesome/better_errors#272.

In the current monkey patch I try to expose the saved bindings publicly
and use Better Errors' code directly if available. This should fix the
bug above.

As for the JRuby support, its kinda finicky. On CRuby, we can depend on
Exception#set_backtrace being called on every exception. This is not the
case for JRuby. We can override Exception#initialize, which does get
called. The problem is that custom exception overriding #initialize
often forget to call super in it, so we'll miss those.

Those hacks are done only for JRuby and not CRuby.