Sha256: 3faccc74d2fed7cb6529c1bf512003c5304931c0bfadbcf78e68abc9397cbd84

Contents?: true

Size: 821 Bytes

Versions: 11

Compression:

Stored size: 821 Bytes

Contents

class Exception < `Error`
  attr_reader :message

  def self.new(message = '')
    %x{
      var err = new Error(message);
      err._klass = #{self};
      return err;
    }
  end

  def backtrace
    %x{
      var backtrace = #{self}.stack;

      if (typeof(backtrace) === 'string') {
        return backtrace.split("\\n").slice(0, 15);
      }
      else if (backtrace) {
        return backtrace.slice(0, 15);
      }

      return [];
    }
  end

  def inspect
    "#<#{self.class.name}: '#@message'>"
  end

  alias to_s message
end

StandardError   = Exception
RuntimeError    = Exception
LocalJumpError  = Exception
TypeError       = Exception
NameError       = Exception
NoMethodError   = Exception
ArgumentError   = Exception
IndexError      = Exception
KeyError        = Exception
RangeError      = Exception

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
opal-0.3.37 lib/assets/javascripts/opal/error.rb
opal-0.3.36 lib/assets/javascripts/opal/error.rb
opal-0.3.35 lib/assets/javascripts/opal/error.rb
opal-0.3.34 lib/assets/javascripts/opal/error.rb
opal-0.3.33 core/error.rb
opal-0.3.32 core/error.rb
opal-0.3.31 core/error.rb
opal-0.3.30 core/error.rb
opal-0.3.29 core/error.rb
opal-0.3.28 core/error.rb
opal-0.3.27 core/error.rb