From: Mark Hubbart Date: 2005-04-21T02:29:55+09:00 Subject: Re: No Rescue from RubyGem's require__ ? On 4/20/05, Trans wrote: > I have the latest version of RubyGems installed and I seem to be > getting an unexpected error b/c of it: > > irb(main):001:0> begin > irb(main):002:1* require 'carat/functor' > irb(main):003:1> rescue > irb(main):004:1> class Functor > irb(main):005:2> def initialize(&func) ; @func = func ; end > irb(main):006:2> def method_missing(op, *args) ; @func.call(op, > *args) ; end > irb(main):007:2> end > irb(main):008:1> end > LoadError: No such file to load -- carat/functor > from > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:18:in > `require__' > from > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:18:in `require' > from (irb):2 > > Shouldn't the rescue clause be picked up? Without rubygems: begin require "nonesuch" rescue puts "rescued!" end LoadError: No such file to load -- nonesuch from (irb):2:in `require' from (irb):2 you need to rescue LoadError: require 'rubygems' ==>true begin require "nonesuch" rescue LoadError puts "rescued!" end rescued! ==>nil cheers, Mark