Skip to content

Commit

Permalink
Fix error logging in object_changes_deserialized
Browse files Browse the repository at this point in the history
I was trying to debug some code that was throwing a:

```
Psych::DisallowedClass: Tried to load unspecified class: Time
```

This warning was not being printed, because `Psych::DisallowedClass` is a subclass of `Psych::Exception`. So I think you want to use `is_a?`, not `instance_of?`.
  • Loading branch information
ghiculescu authored Nov 28, 2023
1 parent 47dbc22 commit 608c87a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/paper_trail/version_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def object_changes_deserialized
begin
PaperTrail.serializer.load(object_changes)
rescue StandardError => e
if defined?(::Psych::Exception) && e.instance_of?(::Psych::Exception)
if defined?(::Psych::Exception) && e.is_a?(::Psych::Exception)
::Kernel.warn format(E_YAML_PERMITTED_CLASSES, e)
end
{}
Expand Down

0 comments on commit 608c87a

Please sign in to comment.