Exception: Exception

Defined in:
lib/web_console/core_ext/exception/cruby.rb,
lib/web_console/core_ext/exception/jruby.rb,
lib/web_console/core_ext/exception/rubinius.rb

Instance Method Summary collapse

Instance Method Details

#bindingsObject

The bindings in which the exception originated in.



3
4
5
# File 'lib/web_console/core_ext/exception/jruby.rb', line 3

def bindings
  @bindings || []
end

#initialize_with_binding_of_caller(*args) ⇒ Object

Rubinius, as JRuby, won’t call Exception#set_backtrace. This means we’ll miss custom exceptions overriding #initialize, but forgetting to call super.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/web_console/core_ext/exception/jruby.rb', line 10

def initialize_with_binding_of_caller(*args)
  unless Thread.current[:__web_console_exception_lock]
    Thread.current[:__web_console_exception_lock] = true
    begin
      @bindings = binding.callers.drop(1)
    ensure
      Thread.current[:__web_console_exception_lock] = false
    end
  end

  initialize_without_binding_of_caller(*args)
end