Exception: Polyphony::BaseException

Inherits:
Exception show all
Defined in:
lib/polyphony/core/exceptions.rb

Overview

Base exception class for interrupting fibers. These exceptions allow control of fibers. BaseException exceptions can encapsulate a value and thus provide a way to interrupt long-running blocking operations while still passing a value back to the call site. BaseException exceptions can also references a cancel scope in order to allow correct bubbling of exceptions through nested cancel scopes.

Direct Known Subclasses

Cancel, Interjection, MoveOn, Restart, Terminate

Instance Attribute Summary collapse

Attributes inherited from Exception

#raising_fiber, #source_fiber

Instance Method Summary collapse

Methods inherited from Exception

#backtrace, instantiate, #invoke

Constructor Details

#initialize(value = nil) ⇒ BaseException

Initializes the exception, setting the caller and the value.

Parameters:

  • value (any) (defaults to: nil)

    Exception value



17
18
19
20
21
# File 'lib/polyphony/core/exceptions.rb', line 17

def initialize(value = nil)
  @caller_backtrace = caller
  @value = value
  super
end

Instance Attribute Details

#valueObject (readonly)

Exception value, used mainly for MoveOn exceptions.



12
13
14
# File 'lib/polyphony/core/exceptions.rb', line 12

def value
  @value
end