Exception: Rhino::JSError
Instance Method Summary collapse
-
#cause ⇒ Object
most likely a Rhino::JS::JavaScriptException.
-
#initialize(native) ⇒ JSError
constructor
A new instance of JSError.
- #javascript_backtrace ⇒ Object
- #unwrap ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(native) ⇒ JSError
Returns a new instance of JSError.
6 7 8 9 10 |
# File 'lib/rhino/error.rb', line 6 def initialize(native) @native = native # NativeException wrapping a Java Throwable = value ? value : ( cause ? cause.details : @native ) super() end |
Instance Method Details
#cause ⇒ Object
most likely a Rhino::JS::JavaScriptException
13 14 15 |
# File 'lib/rhino/error.rb', line 13 def cause @native.respond_to?(:cause) ? @native.cause : nil end |
#javascript_backtrace ⇒ Object
43 44 45 |
# File 'lib/rhino/error.rb', line 43 def javascript_backtrace cause.is_a?(JS::RhinoException) ? cause.getScriptStackTrace : nil end |
#unwrap ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rhino/error.rb', line 28 def unwrap return @unwrap if defined?(@unwrap) cause = self.cause if cause && cause.is_a?(JS::WrappedException) e = cause.getWrappedException if e && e.is_a?(Java::OrgJrubyExceptions::RaiseException) @unwrap = e.getException else @unwrap = e end else @unwrap = nil end end |
#value ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rhino/error.rb', line 17 def value return @value if defined?(@value) if cause.respond_to?(:value) # e.g. JavaScriptException.getValue @value = cause.value elsif ( unwrap = self.unwrap ) && unwrap.respond_to?(:value) @value = unwrap.value else @value = nil end end |