Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any extra that we are passed we should dup #638

Merged
merged 1 commit into from
Sep 18, 2017
Merged
Show file tree
Hide file tree
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
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