- BatchUpdateEntityByKV中panic时,打印调试信息
This commit is contained in:
@@ -73,8 +73,24 @@ func BatchUpdateEntityByKV(db *DaoDB, items []*KVUpdateItem) (num int64, err err
|
||||
// }
|
||||
// }
|
||||
// }()
|
||||
for _, v := range items {
|
||||
num2, err2 := UpdateEntityByKV(db, v.Item, v.KVs, nil)
|
||||
|
||||
var item *KVUpdateItem
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
if item != nil {
|
||||
var bindID int64
|
||||
value := refutil.CheckAndGetStructValue(item.Item).FieldByName(model.FieldID)
|
||||
if value.IsValid() {
|
||||
bindID = value.Int()
|
||||
}
|
||||
globals.SugarLogger.Debugf("BatchUpdateEntityByKV panic, bindID:%d, KVs:%s", bindID, utils.Format4Output(item.KVs, true))
|
||||
}
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
|
||||
for _, item = range items {
|
||||
num2, err2 := UpdateEntityByKV(db, item.Item, item.KVs, nil)
|
||||
if err = err2; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user