Exception: Exception
- Defined in:
- opal/opal/corelib/error.rb
Direct Known Subclasses
Enumerator::Lazy::StopLazyError, Interrupt, NoMemoryError, ScriptError, SignalException, StandardError, SystemExit
Instance Attribute Summary collapse
-
#message ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(message) ⇒ Exception
constructor
A new instance of Exception.
- #inspect ⇒ Object
Constructor Details
#initialize(message) ⇒ Exception
Returns a new instance of Exception
18 19 20 |
# File 'opal/opal/corelib/error.rb', line 18 def initialize() `self.message = message` end |
Instance Attribute Details
#message ⇒ Object (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 end |
Class Method Details
.new(message = 'Exception') ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'opal/opal/corelib/error.rb', line 4 def self.new( = 'Exception') %x{ var err = new self.$$alloc(message); if (Error.captureStackTrace) { Error.captureStackTrace(err); } err.name = self.$$name; err.$initialize(message); return err; } end |
Instance Method Details
#backtrace ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'opal/opal/corelib/error.rb', line 22 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 |
#inspect ⇒ Object
37 38 39 |
# File 'opal/opal/corelib/error.rb', line 37 def inspect "#<#{self.class}: '#@message'>" end |