Skip to content

Commit

Permalink
Merge pull request #638 from rollbar/allow-frozen-things
Browse files Browse the repository at this point in the history
any extra that we are passed we should dup
  • Loading branch information
rokob authored Sep 18, 2017
2 parents 1f9a67e + 48c7975 commit 7077723
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rollbar/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def extract_arguments(args)
end
end

[message, exception, extra]
[message, exception, Rollbar::Util.deep_dup(extra)]
end

def lookup_exception_level(orig_level, exception, use_exception_level_filters)
Expand Down
15 changes: 15 additions & 0 deletions lib/rollbar/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ def self.deep_copy(obj)
end
end

def self.deep_dup(obj)
if obj.is_a?(::Hash)
result = obj.dup
obj.each { |k, v| result[k] = deep_dup(v)}
result
elsif obj.is_a?(Array)
result = obj.dup
result.clear
obj.each { |v| result << deep_dup(v)}
result
else
obj.dup
end
end

def self.deep_merge(hash1, hash2)
hash1 ||= {}
hash2 ||= {}
Expand Down

0 comments on commit 7077723

Please sign in to comment.