Skip to content

Commit 9c6f387

Browse files
authored
Fix breadcrumb serialization error to be an object (#2584)
1 parent ec34db9 commit 9c6f387

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
- Gracefully fail on malformed utf-8 breadcrumb message ([#2582](https://github.com/getsentry/sentry-ruby/pull/2582))
1111
- Fixes [#2376](https://github.com/getsentry/sentry-ruby/issues/2376)
12+
- Fix breadcrumb serialization error message to be an object ([#2584](https://github.com/getsentry/sentry-ruby/pull/2584))
13+
- Fixes [#2478](https://github.com/getsentry/sentry-ruby/issues/2478)
1214

1315
## 5.23.0
1416

sentry-ruby/lib/sentry/breadcrumb.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def serialized_data
7070
MSG
7171
end
7272

73-
DATA_SERIALIZATION_ERROR_MESSAGE
73+
{ error: DATA_SERIALIZATION_ERROR_MESSAGE }
7474
end
7575
end
7676
end

sentry-ruby/spec/sentry/breadcrumb_buffer_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
expect(result[0][:data]).to eq({ "name" => "John", "age" => 25 })
7070
expect(result[1][:category]).to eq("bar")
7171
expect(result[2][:category]).to eq("baz")
72-
expect(result[2][:data]).to eq("[data were removed due to serialization issues]")
72+
expect(result[2][:data][:error]).to eq("[data were removed due to serialization issues]")
7373
end
7474
end
7575
end

sentry-ruby/spec/sentry/breadcrumb_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104

105105
expect(result[:category]).to eq("baz")
106106
expect(result[:message]).to eq("I cause issues")
107-
expect(result[:data]).to eq("[data were removed due to serialization issues]")
107+
expect(result[:data][:error]).to eq("[data were removed due to serialization issues]")
108108
expect(stringio.string).to match(/can't serialize breadcrumb data because of error: nesting of 10 is too deep/)
109109
end
110110

@@ -113,7 +113,7 @@
113113

114114
expect(result[:category]).to eq("cow")
115115
expect(result[:message]).to eq("I cause too much recursion")
116-
expect(result[:data]).to eq("[data were removed due to serialization issues]")
116+
expect(result[:data][:error]).to eq("[data were removed due to serialization issues]")
117117
expect(stringio.string).to match(/can't serialize breadcrumb data because of error: nesting of 10 is too deep/)
118118
end
119119
end

0 commit comments

Comments
 (0)