Skip to content

Commit

Permalink
repair ExceptionHandler#exception_text for Ruby 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hyuraku committed Aug 30, 2023
1 parent 52799c4 commit 8c89d57
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/pry/exception_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ def standard_error_text_for(exception)
end

def exception_text(exception)
"#{exception.class}: #{exception.message}\n" \
"from #{exception.backtrace.first}\n"
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.2')
"#{exception.class}: #{exception.message}\n" \
"from #{exception.backtrace.first}\n"
else
"#{exception.class}: #{exception.detailed_message}\n" \
"from #{exception.backtrace.first}\n"
end
end

def cause_text(cause)
Expand Down

0 comments on commit 8c89d57

Please sign in to comment.