Sha256: 60ecf0f9a84ef59bc561b9f266036c9ead1323c048ddf545a7875d41a6101c83
Contents?: true
Size: 967 Bytes
Versions: 11
Compression:
Stored size: 967 Bytes
Contents
package com.gsamokovarov.skiptrace; import org.jruby.runtime.EventHook; import org.jruby.runtime.RubyEvent; import org.jruby.runtime.ThreadContext; import org.jruby.runtime.builtin.IRubyObject; import org.jruby.RubyArray; import org.jruby.RubyException; public class SetExceptionBindingsEventHook extends EventHook { public boolean isInterestedInEvent(RubyEvent event) { return event == RubyEvent.RAISE; } public void eventHandler(ThreadContext context, String eventName, String file, int line, String name, IRubyObject type) { RubyArray bindings = RubyBindingsCollector.collectCurrentFor(context); RubyException exception = (RubyException) context.runtime.getGlobalVariables().get("$!"); IRubyObject exceptionBindings = exception.getInstanceVariable("@bindings"); if (exceptionBindings == null || exceptionBindings.isNil()) { exception.setInstanceVariable("@bindings", bindings); } } }
Version data entries
11 entries across 11 versions & 4 rubygems