From af5143187df430fe80fdbcf6fc0b2f8543a8e741 Mon Sep 17 00:00:00 2001 From: Matt Ketmo Date: Mon, 26 Aug 2024 09:15:24 +0200 Subject: [PATCH] fix: handle missing vote query that return an error (#80) --- pkg/watcher/votes.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/watcher/votes.go b/pkg/watcher/votes.go index 19a7528..e1baf95 100644 --- a/pkg/watcher/votes.go +++ b/pkg/watcher/votes.go @@ -120,7 +120,11 @@ func (w *VotesWatcher) fetchProposalsV1(ctx context.Context, node *rpc.Node) (ma if isInvalidArgumentError(err) { votes[proposal.Id][validator] = false } else if err != nil { - return votes, fmt.Errorf("failed to get validator vote for proposal %d: %w", proposal.Id, err) + votes[proposal.Id][validator] = false + log.Warn(). + Str("validator", validator.Name). + Str("proposal", fmt.Sprintf("%d", proposal.Id)). + Err(err).Msg("failed to get validator vote for proposal") } else { vote := voteResp.GetVote() voted := false @@ -173,7 +177,11 @@ func (w *VotesWatcher) fetchProposalsV1Beta1(ctx context.Context, node *rpc.Node if isInvalidArgumentError(err) { votes[proposal.ProposalId][validator] = false } else if err != nil { - return votes, fmt.Errorf("failed to get validator vote for proposal %d: %w", proposal.ProposalId, err) + votes[proposal.ProposalId][validator] = false + log.Warn(). + Str("validator", validator.Name). + Str("proposal", fmt.Sprintf("%d", proposal.ProposalId)). + Err(err).Msg("failed to get validator vote for proposal") } else { vote := voteResp.GetVote() voted := false