From 19cbc17f351e3c8e596d0929b38d33b2eafa0f7a Mon Sep 17 00:00:00 2001 From: Vladislav Veselskiy Date: Wed, 13 Mar 2024 15:49:29 +0300 Subject: [PATCH] Add logs for func saveStruct. --- save.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/save.go b/save.go index 989cdc3..e88fe34 100644 --- a/save.go +++ b/save.go @@ -217,14 +217,20 @@ func saveStruct( row, _ = dataItem.Addr().Interface().(meta.IMetaStruct) } if row == nil { - return errors.Errorf("Couldn't convert to IMetaStruct: %s", mType.Name()) + err := errors.Errorf("Couldn't convert to IMetaStruct: %s", mType.Name()) + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err } props := *row.CLASS_PROPS() if ownerField, ok := props["owner"]; ok { field := dataItem.FieldByName(strings.Title(ownerField)) if !field.IsValid() { - return errors.Errorf("Owner field \"%s\" is not found in struct \"%s\"", ownerField, mType.Name()) + err := errors.Errorf("Owner field \"%s\" is not found in struct \"%s\"", ownerField, mType.Name()) + span.RecordError(err) + span.SetStatus(codes.Error, err.Error()) + return err } // enforcing ownerId