🎨 Improve update tx
This commit is contained in:
parent
1fde0611c3
commit
7e2d2bfe37
1 changed files with 10 additions and 4 deletions
|
@ -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}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue