Skip to content

Commit

Permalink
ruby 3.3 does not inspect an object when an exception is raised
Browse files Browse the repository at this point in the history
NoMethod error usess a lot of CPU calling inspect on an object that has
raised the error. In ruby 3.3 inspect has been removed and now the exception
will only contain the objects name that had the issue instead of inspecting it.

see
https://github.com/ruby/ruby/blob/v3_3_0/NEWS.md#compatibility-issues

```
Error message for NoMethodError have changed to not use the target object's #inspect for efficiency, and says "instance of ClassName" instead. [Feature #18285]

([1] * 100).nonexisting

```
  • Loading branch information
aliuk2012 committed Jan 2, 2024
1 parent 978a1b5 commit fac3e29
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions spec/integration/sentry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@
expect(filtered_event.to_hash.to_s).not_to include "submission-email@test.example"
end

it "replaces the email address in the exception with a comment" do
expect(filtered_event.to_hash[:exception][:values].first[:value]).to include "[Filtered (client-side)]"
end

it "keeps the rest of the exception message" do
expect(filtered_event.to_hash[:exception][:values].first[:value]).to include "undefined method"
expect(filtered_event.to_hash[:exception][:values].first[:value]).to eq "undefined method `not_a_method' for an instance of Form (NoMethodError)"
end
end

Expand Down

0 comments on commit fac3e29

Please sign in to comment.