Skip to content

Commit

Permalink
do not panic
Browse files Browse the repository at this point in the history
  • Loading branch information
rjonczy committed Apr 29, 2024
1 parent 09987e8 commit 627f609
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"fmt"
"io"
"net/http"
)
Expand Down Expand Up @@ -64,5 +65,8 @@ func getLatestProposal(cosmosEndpoint string) (*Proposal, error) {
if err != nil {
return nil, err
}
if len(proposalsData.Proposals) == 0 {
return nil, fmt.Errorf("no proposals found")
}
return &proposalsData.Proposals[0], nil
}

0 comments on commit 627f609

Please sign in to comment.