@@ -6,6 +6,7 @@ package atomic
6
6
import (
7
7
"bytes"
8
8
"errors"
9
+ "fmt"
9
10
10
11
"github.com/ava-labs/avalanchego/database"
11
12
"github.com/ava-labs/avalanchego/database/linkeddb"
@@ -16,7 +17,10 @@ import (
16
17
"github.com/ava-labs/avalanchego/utils/set"
17
18
)
18
19
19
- var errDuplicatedOperation = errors .New ("duplicated operation on provided value" )
20
+ var (
21
+ errDuplicatePut = errors .New ("duplicate put" )
22
+ errDuplicateRemove = errors .New ("duplicate remove" )
23
+ )
20
24
21
25
type dbElement struct {
22
26
// Present indicates the value was removed before existing.
@@ -86,7 +90,7 @@ func (s *state) SetValue(e *Element) error {
86
90
}
87
91
88
92
// This key was written twice, which is invalid
89
- return errDuplicatedOperation
93
+ return fmt . Errorf ( "%w: Key=0x%x Value=0x%x" , errDuplicatePut , e . Key , e . Value )
90
94
}
91
95
if err != database .ErrNotFound {
92
96
// An unexpected error occurred, so we should propagate that error
@@ -160,7 +164,7 @@ func (s *state) RemoveValue(key []byte) error {
160
164
161
165
// Don't allow the removal of something that was already removed.
162
166
if ! value .Present {
163
- return errDuplicatedOperation
167
+ return fmt . Errorf ( "%w: Key=0x%x" , errDuplicateRemove , key )
164
168
}
165
169
166
170
// Remove [key] from the indexDB for each trait that has indexed this key.
0 commit comments