Sha256: 6e9a4a098b19ccb1d49319fba778483645037dab2a1aa52764006aa813879894

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

class Exception
  # we also need to set err.$m to the right method table incase a subclass adds
  # custom methods.. just get this from the klass: self.
  def self.allocate
    `var err = new Error();
    err.$klass = self;
    return err;`
  end

  def initialize(message = '')
    @message = message
    `return self.message = self.$klass.__classid__ + ': ' + message;`
  end

  def message
    @message
  end

  def inspect
    `return "#<" + self.$klass.__classid__ + ": '" + #{@message} + "'>";`
  end

  def to_s
    @message
  end
end

class StandardError < Exception; end
class RuntimeError < Exception; end
class LocalJumpError < StandardError; end
class TypeError < StandardError; end

class NameError < StandardError; end
class NoMethodError < NameError; end
class ArgumentError < StandardError; end

class ScriptError < Exception; end
class LoadError < ScriptError; end

class IndexError < StandardError; end
class KeyError < IndexError; end
class RangeError < StandardError; end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-0.3.1 gems/core/lib/core/error.rb
opal-0.3.0 gems/core/lib/core/error.rb