small medium large xlarge

Me_pragsmall
06 Dec 2011, 00:35
Richard Michael (6 posts)

In the AsyncModule code (p169), “rescue => error” won’t rescue if the reader is using MiniTest::Assertions. Without an explicit class name to rescue, “rescue => error” will behave as “rescue StandardError => e”, and because MiniTest::Assertion does not sub-class StandardError (“MiniTest::Assertion < Exception”) the MiniTest raised exception will not be rescued.

I worked through the entire book using MiniTest (instead of rspec-expectations), and this is the only code which posed a problem. Given the discussion of other assertion libraries on p59 “Matt says: Choosing Your Assertion Library”, it might be worth helping readers who choose MiniTest.

module AsyncSupport
  …
    begin
      yield
    rescue Exception => e
    end
  …
end
Avatar_pragsmall
06 Dec 2011, 20:25
Matt Wynne (92 posts)

Thanks for the feedback, that will be fixed in the production version of the book.

You must be logged in to comment