File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,9 @@ def _serialize_node_impl(
281
281
else :
282
282
return obj
283
283
284
+ elif callable (getattr (obj , "sentry_repr" , None )):
285
+ return obj .sentry_repr ()
286
+
284
287
elif isinstance (obj , datetime ):
285
288
return (
286
289
text_type (format_timestamp (obj ))
Original file line number Diff line number Diff line change @@ -64,3 +64,12 @@ def test_bytes_serialization_repr(message_normalizer):
64
64
def test_serialize_sets (extra_normalizer ):
65
65
result = extra_normalizer ({1 , 2 , 3 })
66
66
assert result == [1 , 2 , 3 ]
67
+
68
+
69
+ def test_serialize_custom_mapping (extra_normalizer ):
70
+ class CustomReprDict (dict ):
71
+ def sentry_repr (self ):
72
+ return "custom!"
73
+
74
+ result = extra_normalizer (CustomReprDict (one = 1 , two = 2 ))
75
+ assert result == "custom!"
You can’t perform that action at this time.
0 commit comments