From b31ca726e23a1b18d6ebf5ecb29631238caffba1 Mon Sep 17 00:00:00 2001 From: Vladislav Veselskiy Date: Mon, 11 Mar 2024 13:10:13 +0300 Subject: [PATCH] Add logs for func saveStruct --- save.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/save.go b/save.go index 8baa559..e4b2b4c 100644 --- a/save.go +++ b/save.go @@ -195,7 +195,12 @@ func SaveMetaRootStruct( return nil } -func saveStruct(ctx context.Context, db *db.DBC, dataItem reflect.Value, ownerId uint32) error { +func saveStruct( + ctx context.Context, + db *db.DBC, + dataItem reflect.Value, + ownerId uint32, +) error { ctx, span := tracer.Start(ctx, "saveStruct") defer span.End() @@ -228,7 +233,13 @@ func saveStruct(ctx context.Context, db *db.DBC, dataItem reflect.Value, ownerId } - return SaveRow(ctx, db, row) + if err := SaveRow(ctx, db, row); err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err + } + + return nil } func SaveMetaCollection(ctx context.Context, db *db.DBC, slice reflect.Value, ownerId uint32, removedIds meta.IRemovedIds, deltaSave bool) error {