Skip to content

Commit 7ebf399

Browse files
committed
test(active_job): compact DeserializationError backtrace to avoid JRuby NPE
1 parent 5948fef commit 7ebf399

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

sentry-rails/spec/active_job/shared_examples/deserialization_error.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
def perform
77
1 / 0
88
rescue
9-
raise ActiveJob::DeserializationError
9+
err = ActiveJob::DeserializationError.new
10+
# DeserializationError#initialize copies $!.backtrace, which on JRuby can
11+
# contain nil elements for frames defined in anonymous Class.new blocks.
12+
# Compact the backtrace to avoid a JRuby NPE in traceRaise at shutdown.
13+
err.set_backtrace(Array(err.backtrace).compact)
14+
raise err
1015
end
1116
end
1217
end

0 commit comments

Comments
 (0)