correctl wrapping redis nil error

This commit is contained in:
pippellia-btc
2025-06-16 13:43:16 +02:00
parent 3d71e908b5
commit 3c01393118

View File

@@ -115,6 +115,9 @@ func (db RedisDB) NodeByID(ctx context.Context, ID graph.ID) (*graph.Node, error
func (db RedisDB) NodeByKey(ctx context.Context, pubkey string) (*graph.Node, error) { func (db RedisDB) NodeByKey(ctx context.Context, pubkey string) (*graph.Node, error) {
ID, err := db.Client.HGet(ctx, KeyKeyIndex, pubkey).Result() ID, err := db.Client.HGet(ctx, KeyKeyIndex, pubkey).Result()
if err != nil { if err != nil {
if errors.Is(err, redis.Nil) {
err = graph.ErrNodeNotFound
}
return nil, fmt.Errorf("failed to fetch ID of node with pubkey %s: %w", pubkey, err) return nil, fmt.Errorf("failed to fetch ID of node with pubkey %s: %w", pubkey, err)
} }