Skip to content

Commit

Permalink
more error annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilchainani committed Feb 3, 2025
1 parent 6236e37 commit a6babc4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func decodeAndValidateProposal[T ProposalInterface](reader io.Reader) (T, error)
// Decode the proposal
var proposal T
if err := json.NewDecoder(reader).Decode(&proposal); err != nil {
return proposal, err
return proposal, fmt.Errorf("failed to decode proposal: %w", err)
}

// Validate the proposal
if err := proposal.Validate(); err != nil {
return proposal, err
return proposal, fmt.Errorf("failed to validate proposal: %w", err)
}

return proposal, nil
Expand Down

0 comments on commit a6babc4

Please sign in to comment.