Add logs for func saveStruct

This commit is contained in:
Владислав Весельский 2024-03-11 13:10:13 +03:00
parent 9dfbdbe878
commit b31ca726e2
1 changed files with 13 additions and 2 deletions

15
save.go
View File

@ -195,7 +195,12 @@ func SaveMetaRootStruct(
return nil 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") ctx, span := tracer.Start(ctx, "saveStruct")
defer span.End() 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 { func SaveMetaCollection(ctx context.Context, db *db.DBC, slice reflect.Value, ownerId uint32, removedIds meta.IRemovedIds, deltaSave bool) error {