...
1 package storage
2
3 import (
4 "errors"
5 "fmt"
6 )
7
8 var ErrNotImplemented = errors.New("not implemented")
9
10
11
12 type isNotExister interface {
13 isNotExist() bool
14 }
15
16
17
18 func IsNotExist(err error) bool {
19 var e isNotExister
20 if err != nil && errors.As(err, &e) {
21 return e.isNotExist()
22 }
23
24 return false
25 }
26
27
28
29 type notExistError struct {
30 Path string
31 }
32
33 func (e *notExistError) isNotExist() bool { return true }
34
35
36 func (e *notExistError) Error() string {
37 return fmt.Sprintf("storage %v: path does not exist", e.Path)
38 }
39
View as plain text