mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-10 15:01:03 +00:00
replace error with wrap
This commit is contained in:
parent
94d7b295ea
commit
2711bf321f
2 changed files with 12 additions and 15 deletions
12
rbf.go
12
rbf.go
|
|
@ -285,19 +285,19 @@ func (tx *RBFTx) addOrRemove(index, field, view string, shard uint64, batched, r
|
|||
if remove && (rc == nil || rc.N() == 0) {
|
||||
err = tx.RemoveContainer(index, field, view, shard, lastHi)
|
||||
if err != nil {
|
||||
return 0, rbf.ErrTxFailedToRemoveContainer
|
||||
return 0, errors.Wrap(err, "failed to remove container")
|
||||
}
|
||||
} else {
|
||||
err = tx.PutContainer(index, field, view, shard, lastHi, rc)
|
||||
if err != nil {
|
||||
return 0, rbf.ErrTxFailedToPutContainer
|
||||
return 0, errors.Wrap(err, "failed to put container")
|
||||
}
|
||||
}
|
||||
}
|
||||
// get the next container
|
||||
rc, err = tx.Container(index, field, view, shard, hi)
|
||||
if err != nil {
|
||||
return 0, rbf.ErrTxFailedToRetrieveContainer
|
||||
return 0, errors.Wrap(err, "failed to retrieve container")
|
||||
}
|
||||
} // else same container, keep adding bits to rct.
|
||||
chng := false
|
||||
|
|
@ -318,12 +318,12 @@ func (tx *RBFTx) addOrRemove(index, field, view string, shard uint64, batched, r
|
|||
if rc == nil || rc.N() == 0 {
|
||||
err = tx.RemoveContainer(index, field, view, shard, hi)
|
||||
if err != nil {
|
||||
return 0, rbf.ErrTxFailedToRemoveContainer
|
||||
return 0, errors.Wrap(err, "failed to remove container")
|
||||
}
|
||||
} else {
|
||||
err = tx.PutContainer(index, field, view, shard, hi, rc)
|
||||
if err != nil {
|
||||
return 0, rbf.ErrTxFailedToPutContainer
|
||||
return 0, errors.Wrap(err, "failed to put container")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -332,7 +332,7 @@ func (tx *RBFTx) addOrRemove(index, field, view string, shard uint64, batched, r
|
|||
}
|
||||
err = tx.PutContainer(index, field, view, shard, hi, rc)
|
||||
if err != nil {
|
||||
return 0, rbf.ErrTxFailedToPutContainer
|
||||
return 0, errors.Wrap(err, "failed to put container")
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
|
|||
15
rbf/rbf.go
15
rbf/rbf.go
|
|
@ -111,15 +111,12 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
ErrTxClosed = errors.New("transaction closed")
|
||||
ErrTxNotWritable = errors.New("transaction not writable")
|
||||
ErrBitmapNameRequired = errors.New("bitmap name required")
|
||||
ErrBitmapNotFound = errors.New("bitmap not found")
|
||||
ErrBitmapExists = errors.New("bitmap already exists")
|
||||
ErrTxTooLarge = errors.New("rbf tx too large")
|
||||
ErrTxFailedToRemoveContainer = errors.New("rbf tx failed to remove container")
|
||||
ErrTxFailedToPutContainer = errors.New("rbf tx failed to put container")
|
||||
ErrTxFailedToRetrieveContainer = errors.New("rbf tx failed to put container")
|
||||
ErrTxClosed = errors.New("transaction closed")
|
||||
ErrTxNotWritable = errors.New("transaction not writable")
|
||||
ErrBitmapNameRequired = errors.New("bitmap name required")
|
||||
ErrBitmapNotFound = errors.New("bitmap not found")
|
||||
ErrBitmapExists = errors.New("bitmap already exists")
|
||||
ErrTxTooLarge = errors.New("rbf tx too large")
|
||||
)
|
||||
|
||||
// Debug is just a temporary flag used for debugging.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue