Add logs for SaveRow.
This commit is contained in:
parent
19cbc17f35
commit
afb9845d70
13
save.go
13
save.go
|
@ -49,6 +49,8 @@ func SaveRow(ctx context.Context, db *db.DBC, dataItem meta.IMetaStruct) error {
|
|||
|
||||
info, err := makeDataRowInfo(dataItem)
|
||||
if err != nil {
|
||||
span.RecordError(err)
|
||||
span.SetStatus(codes.Error, err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -77,7 +79,10 @@ func SaveRow(ctx context.Context, db *db.DBC, dataItem meta.IMetaStruct) error {
|
|||
}
|
||||
|
||||
if len(fields) == 0 {
|
||||
return errors.New("Fields list is empty")
|
||||
err := errors.New("Fields list is empty")
|
||||
span.RecordError(err)
|
||||
span.SetStatus(codes.Error, err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
tableName := info.tableName
|
||||
|
@ -97,7 +102,11 @@ func SaveRow(ctx context.Context, db *db.DBC, dataItem meta.IMetaStruct) error {
|
|||
if len(sqlSmt) > 200 {
|
||||
sqlSmt = sqlSmt[0:200]
|
||||
}
|
||||
return errors.Errorf("Can not execute SaveRow. Got error from updateBuilder.ExecContext. %s (%s)", err.Error(), sqlSmt)
|
||||
|
||||
resultErr := errors.Errorf("Can not execute SaveRow. Got error from updateBuilder.ExecContext. %s (%s)", err.Error(), sqlSmt)
|
||||
span.RecordError(resultErr)
|
||||
span.SetStatus(codes.Error, resultErr.Error())
|
||||
return resultErr
|
||||
}
|
||||
|
||||
insertId, _ := res.LastInsertId()
|
||||
|
|
Loading…
Reference in New Issue