lib/polyphony/extensions/fiber.rb
# Runs the fiber's block and handles uncaught exceptions.
#
# @param first_value [any] value passed to fiber on first resume
# @return [void]
Runs the fiber's block and handles uncaught exceptions.
Runs the fiber ' s block and handles uncaught exceptions .
def run(first_value)
      Kernel.raise first_value if first_value.is_a?(Exception)
      @running = true
      Thread.backend.trace(:unblock, self, first_value, @caller)
      result = @block.(first_value)
      finalize(result)
    rescue Polyphony::Restart => e
      restart_self(e.value)
    rescue Polyphony::MoveOn, Polyphony::Terminate => e
      finalize(e.value)
    rescue Exception => e
      e.source_fiber = self
      finalize(e, true)
    end
def run ( first_value ) Kernel . raise first_value if first_value . is_a? ( Exception ) @running = true Thread . backend . trace ( :unblock , self , first_value , @caller ) result = @block . ( first_value ) finalize ( result ) rescue Polyphony :: Restart => e restart_self ( e . value ) rescue Polyphony :: MoveOn , Polyphony :: Terminate => e finalize ( e . value ) rescue Exception => e e . source_fiber = self finalize ( e , true ) end
Runs the fiber's block and handles uncaught exceptions.
Runs the fiber ' s block and handles uncaught exceptions .
None
void
first_value
value passed to fiber on first resume
value passed to fiber on first resume