Checkpoint
This commit is contained in:
25
dataset/error.go
Normal file
25
dataset/error.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package dataset
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/mjl-/bstore"
|
||||
)
|
||||
|
||||
type ErrNotExist struct {
|
||||
Object string
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (err ErrNotExist) Error() string {
|
||||
return fmt.Sprintf("storage: %s not found", err.Object)
|
||||
}
|
||||
|
||||
func IsNotExist(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
return os.IsNotExist(err) || errors.Is(err, ErrNotExist{}) || errors.Is(err, bstore.ErrAbsent)
|
||||
}
|
Reference in New Issue
Block a user