Skip to content

FiberIterator breaks normal exception handling #206

@dgutov

Description

@dgutov

Example (failing spec):

  it "permits normal handling of errors" do
    caught = nil

    EM.synchrony do
      begin
        EM::Synchrony::FiberIterator.new(0..1, 2).each do |num|
          raise "#{num} here"
        end
      rescue => e
        caught = e.message
      end

      EM.stop
    end

    expect(caught).to eq("0 here")
  end

The rescue block is never entered, and the only way to catch the exception is with EM.error_handler or catching it outside of the EM loop. Neither approach is composable.

@igrigorik Any ideas for an easy fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions