diff --git a/tracing/mongo.go b/tracing/mongo.go index 4d8f6dc..fe217d6 100644 --- a/tracing/mongo.go +++ b/tracing/mongo.go @@ -56,10 +56,13 @@ func parseMongo(payload []byte) string { return bsonToString(reader) } -func bsonToString(r io.Reader) string { - raw, err := bson.NewFromIOReader(r) - if err != nil { - return "" +func bsonToString(r io.Reader) (res string) { + res = "" + defer func() { + recover() + }() + if raw, err := bson.NewFromIOReader(r); err == nil { + res = raw.String() } - return raw.String() + return }