Exception: Exception
- Defined in:
- lib/polyphony/extensions/exception.rb
Overview
Extensions to the Exception class
Direct Known Subclasses
Class Attribute Summary collapse
-
.__disable_sanitized_backtrace__ ⇒ Object
Set to true to disable sanitizing the backtrace (to remove frames occuring in the Polyphony code itself.).
Instance Attribute Summary collapse
-
#raising_fiber ⇒ Object
Set to the fiber from which the exception was raised.
-
#source_fiber ⇒ Object
Set to the fiber in which the exception was originally raised (in case the exception was not caught.) The exception will propagate up the fiber tree, allowing it to be caught in any of the fiber's ancestors, while the
@source_fiber
` attribute will continue pointing to the original fiber.
Class Method Summary collapse
-
.instantiate(error = nil, message = nil) ⇒ Exception
Creates an exception instance from the given error according to its type.
Instance Method Summary collapse
-
#backtrace ⇒ Array<String>
Returns the backtrace for the exception.
-
#initialize(*args) ⇒ Exception
constructor
Initializes the exception with the given arguments.
-
#invoke ⇒ Object
Raises the exception.
Constructor Details
Class Attribute Details
.__disable_sanitized_backtrace__ ⇒ Object
Set to true to disable sanitizing the backtrace (to remove frames occuring in the Polyphony code itself.)
8 9 10 |
# File 'lib/polyphony/extensions/exception.rb', line 8 def __disable_sanitized_backtrace__ @__disable_sanitized_backtrace__ end |
Instance Attribute Details
#raising_fiber ⇒ Object
Set to the fiber from which the exception was raised.
33 34 35 |
# File 'lib/polyphony/extensions/exception.rb', line 33 def raising_fiber @raising_fiber end |
#source_fiber ⇒ Object
Set to the fiber in which the exception was originally raised (in case the
exception was not caught.) The exception will propagate up the fiber tree,
allowing it to be caught in any of the fiber's ancestors, while the
@source_fiber
` attribute will continue pointing to the original fiber.
30 31 32 |
# File 'lib/polyphony/extensions/exception.rb', line 30 def source_fiber @source_fiber end |
Class Method Details
.instantiate(error = nil, message = nil) ⇒ Exception
Creates an exception instance from the given error according to its type.
15 16 17 18 19 20 21 22 23 |
# File 'lib/polyphony/extensions/exception.rb', line 15 def instantiate(error = nil, = nil) case error when String then RuntimeError.new(error) when Array then error[0].new(error[1]) when Class then error.new() when Exception then error else RuntimeError.new end end |
Instance Method Details
#backtrace ⇒ Array<String>
Returns the backtrace for the exception. If
Exception.__disable_sanitized_backtrace__
is not true, any stack frames
occuring in Polyphony's code will be removed from the backtrace.
52 53 54 55 56 57 58 59 |
# File 'lib/polyphony/extensions/exception.rb', line 52 def backtrace unless @backtrace_called @backtrace_called = true return orig_backtrace end sanitized_backtrace end |