all repos — searchix @ 7f7515906b28675a38a9988eb25f9b5b527c9d95

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: improve logging of errors in source ID handler

Alan Pearce
commit

7f7515906b28675a38a9988eb25f9b5b527c9d95

parent

075a0a4a8bfd3dba66a5fbbf88b29d525c35c8be

1 file changed, 9 insertions(+), 0 deletions(-)

changed files
M internal/storage/store.gointernal/storage/store.go
@@ -8,6 +8,7 @@
"alin.ovh/x/log" "github.com/Southclaws/fault" "github.com/Southclaws/fault/fmsg" + "github.com/Southclaws/fault/ftag" "github.com/asdine/storm/v3" "github.com/asdine/storm/v3/codec/gob" "go.etcd.io/bbolt"
@@ -197,6 +198,14 @@ return nil, fault.New("invalid importer type")
} if err != nil { + if errors.Is(err, storm.ErrNotFound) { + return nil, + fault.Wrap( + fault.Newf("document not found source: %s id: %s", source.Key, id), + ftag.With(ftag.NotFound), + ) + } + return nil, fault.Wrap( err, fmsg.Withf("failed to get document source: %s id: %s", source.Key, id),