github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/badger/common.go (about) 1 package badger 2 3 import ( 4 "errors" 5 "fmt" 6 7 "github.com/dgraph-io/badger/v2" 8 9 "github.com/onflow/flow-go/storage" 10 ) 11 12 func handleError(err error, t interface{}) error { 13 if err != nil { 14 if errors.Is(err, badger.ErrKeyNotFound) { 15 return storage.ErrNotFound 16 } 17 18 return fmt.Errorf("could not retrieve %T: %w", t, err) 19 } 20 return nil 21 }