IRB.load_modules Bug?

irb/init.rb contains the following code:

def IRB.load_modules
for m in @CONF[:LOAD_MODULES]
begin
require m
rescue
print [email protected][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

On Dec 3, 11:41 pm, Curt S. [email protected]lid wrote:

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 S. [email protected] +81 90 7737 2974
Starling Software [email protected]
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 [email protected][0], “:”, $!.class, ": ", $!, “\n”
rescue LoadError => e
errors << “\n*** #{e.message}”
end
end
puts “#{errors.join(’’)}\n\n” unless errors.empty?
end

Regards,
Jordan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs