Skip to content

Commit

Permalink
Print more actionable message when the exception may be an IRB issue (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored Jan 11, 2025
1 parent 9fc14eb commit 4d74d39
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/irb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,10 @@ def handle_exception(exc)
# The "<top (required)>" in "(irb)" may be the top level of IRB so imitate the main object.
message = message.gsub(/\(irb\):(?<num>\d+):in (?<open_quote>[`'])<(?<frame>top \(required\))>'/) { "(irb):#{$~[:num]}:in #{$~[:open_quote]}<main>'" }
puts message
puts 'Maybe IRB bug!' if irb_bug

if irb_bug
puts "This may be an issue with IRB. If you believe this is an unexpected behavior, please report it to https://github.com/ruby/irb/issues"
end
rescue Exception => handler_exc
begin
puts exc.inspect
Expand Down

0 comments on commit 4d74d39

Please sign in to comment.