🎨 Improve update tx

This commit is contained in:
Daniel 2023-09-14 09:12:41 +08:00
parent 1fde0611c3
commit 7e2d2bfe37
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -18,6 +18,7 @@ package model
import (
"bytes"
"errors"
"fmt"
"path/filepath"
"sort"
@ -696,11 +697,12 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
var err error
id := operation.ID
tree, err := tx.loadTree(id)
if ErrBlockNotFound == err {
return nil // move 以后这里会空,算作正常情况
}
if nil != err {
if errors.Is(err, ErrBlockNotFound) {
// move 以后这里会空,算作正常情况
return
}
msg := fmt.Sprintf("load tree [%s] failed: %s", id, err)
logging.LogErrorf(msg)
return &TxErr{code: TxErrCodeBlockNotFound, id: id}
@ -926,6 +928,10 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
tree, err := tx.loadTree(id)
if nil != err {
if errors.Is(err, ErrBlockNotFound) {
return
}
logging.LogErrorf("load tree [%s] failed: %s", id, err)
return &TxErr{code: TxErrCodeBlockNotFound, id: id}
}