Exception: JS::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/js.rb,
ext/js/js-core.c

Overview

A wrapper class for JavaScript Error to allow the Error to be thrown in Ruby.

Instance Method Summary collapse

Constructor Details

#initialize(exception) ⇒ Error

Returns a new instance of Error.



282
283
284
285
# File 'lib/js.rb', line 282

def initialize(exception)
  @exception = exception
  super
end

Instance Method Details

#messageObject



287
288
289
290
291
292
293
294
295
# File 'lib/js.rb', line 287

def message
  stack = @exception[:stack]
  if stack.typeof == "string"
    # Error.stack contains the error message also
    stack.to_s
  else
    @exception.to_s
  end
end