On Dec 3, 11:41 pm, Curt Sampson <c... / cynic.net> wrote:
> irb/init.rb contains the following code:
>
>   def IRB.load_modules
>     for m in @CONF[:LOAD_MODULES]
>       begin
>         require m
>       rescue
>         print $@[0], ":", $!.class, ": ", $!, "\n"
>       end
>     end
>   end
>
> Unfortunately, that rescue does not appear to catch LoadError, at least
> on my system (ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-netbsdelf]).
> Is it supposed to?
>
> cjs
> --
> Curt Sampson       <c... / starling-software.com>        +81 90 7737 2974
> Starling Software     <office-ad... / starling-software.com>
> Mobile sites and software consulting:http://www.starling-software.com

I'm not sure of the intended behavior, but in 1.9 it has...

rescue # StandardError, ScriptError

...which makes me think that LoadError is intentionally not rescued.

I've put the following in my .ircrb...

def IRB.load_modules
  errors = []
  for m in @CONF[:LOAD_MODULES]
    begin
      require m
    rescue # StandardError, ScriptError
      print $@[0], ":", $!.class, ": ", $!, "\n"
    rescue LoadError => e
      errors << "\n*** #{e.message}"
    end
  end
  puts "#{errors.join('')}\n\n" unless errors.empty?
end

Regards,
Jordan