Skip to content

Commit

Permalink
Preserve field types when truncating large payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncan Hewett committed Apr 4, 2016
1 parent 5a02ded commit 203ac44
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/bugsnag/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ def self.reduce_hash_size(hash)
h[k] = reduce_hash_size(v)
elsif v.is_a?(Array) || v.is_a?(Set)
h[k] = v.map {|el| reduce_hash_size(el) }
elsif v.is_a?(Integer)
# Preserve integers
h[k] = v
elsif !!v == v
# Preserve booleans
h[k] = v
else
val = v.to_s
val = val.slice(0, MAX_STRING_LENGTH) + "[TRUNCATED]" if val.length > MAX_STRING_LENGTH
Expand Down

0 comments on commit 203ac44

Please sign in to comment.