all: Make all error implementations pointer types (#6726)
This matches the convention of the stdlib and avoids ambiguity: when
customErr{} and &customErr{} both implement error, client code needs to
check for both.
Memory use should remain the same, since storing a non-pointer type in
an interface value still copies the value to the heap.
This commit is contained in:
@@ -402,10 +402,10 @@ func wrapBadgerErr(err error) error {
|
||||
return nil
|
||||
}
|
||||
if err == badger.ErrDiscardedTxn {
|
||||
return errClosed{}
|
||||
return &errClosed{}
|
||||
}
|
||||
if err == badger.ErrKeyNotFound {
|
||||
return errNotFound{}
|
||||
return &errNotFound{}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user