irb.rb: hoist out handle_exception

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-04-13 18:06:35 +00:00
parent 081df64083
commit fb68dfc40e

View file

@ -497,6 +497,13 @@ module IRB
rescue Exception => exc rescue Exception => exc
end end
if exc if exc
handle_exception(exc)
end
end
end
end
def handle_exception(exc)
if exc.backtrace && exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ && if exc.backtrace && exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ &&
!(SyntaxError === exc) !(SyntaxError === exc)
irb_bug = true irb_bug = true
@ -532,9 +539,6 @@ module IRB
puts messages.map {|s| "#{attr[1]}#{s}#{attr[]}\n"} puts messages.map {|s| "#{attr[1]}#{s}#{attr[]}\n"}
print "Maybe IRB bug!\n" if irb_bug print "Maybe IRB bug!\n" if irb_bug
end end
end
end
end
# Evaluates the given block using the given +path+ as the Context#irb_path # Evaluates the given block using the given +path+ as the Context#irb_path
# and +name+ as the Context#irb_name. # and +name+ as the Context#irb_name.