Exception: Exception

Defined in:
opal/opal/corelib/error.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#messageObject (readonly) Also known as: to_s

Returns the value of attribute message



2
3
4
# File 'opal/opal/corelib/error.rb', line 2

def message
  @message
end

Class Method Details

.new(message = '') ⇒ Object



4
5
6
7
8
9
10
11
# File 'opal/opal/corelib/error.rb', line 4

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

Instance Method Details

#backtraceObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'opal/opal/corelib/error.rb', line 13

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

#inspectObject



28
29
30
# File 'opal/opal/corelib/error.rb', line 28

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