Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if defined?(Java)
Java::JavaLang::Throwable.class_eval do
# Ruby's #backtrace_locations isn't defined on Java Throwables. Rails 7.2's
# ActionDispatch::ExceptionWrapper#build_backtrace assumes it exists, and the
# NoMethodError it raises masks the real underlying Java exception (see actionpack/lib/action_dispatch/middleware/exception_wrapper.rb:269)
# https://github.com/jruby/jruby/blob/2e078cd889f0a025ff607d9919f3dfdf9bf24390/core/src/main/java/org/jruby/javasupport/ext/JavaLang.java#L221
#
# This at least allows us to get the message, even though there is no backtrace.
def backtrace_locations
warn "unsupported backtrace_locations access for #{self.inspect}, dumping normal backtrace; and returning empty"
puts self.backtrace
return []
end
end
end