module RubyRunJs::JsErrorMethods
Public Class Methods
constructor(builtin, this, message)
click to toggle source
# File lib/ruby_run_js/object_methods/js_error.rb, line 8 def constructor(builtin, this, message) constructor_new(builtin, this, message) end
constructor_new(builtin, this, message)
click to toggle source
# File lib/ruby_run_js/object_methods/js_error.rb, line 12 def constructor_new(builtin, this, message) builtin.new_error('Error', message == undefined ? message : to_string(message)) end
prototype_toString(builtin, this)
click to toggle source
# File lib/ruby_run_js/object_methods/js_error.rb, line 16 def prototype_toString(builtin, this) if this.js_type != :Object raise make_error('TypeError', 'Error.prototype.toString called on non-object') end name = this.get('name') name = name == undefined ? 'Error' : to_string(name) msg = this.get('message') msg = msg == undefined ? '' : to_string(msg) if name == '' return msg end if msg == '' return name end "#{name}: #{msg}" end