diff --git a/realm/chess.gno b/realm/chess.gno index 2c4465e..cf9f61e 100644 --- a/realm/chess.gno +++ b/realm/chess.gno @@ -42,9 +42,7 @@ type Game struct { func (g Game) json() string { s, err := g.MarshalJSON() - if err != nil { - panic(err) - } + checkErr(err) return string(s) } diff --git a/realm/chess_test.gno b/realm/chess_test.gno index f52e58c..a592143 100644 --- a/realm/chess_test.gno +++ b/realm/chess_test.gno @@ -350,9 +350,7 @@ func parseCommandTest(t *testing.T, command string) (funcs []testCommandRunner, lines := strings.Split(command, "\n") atoi := func(s string) int { n, err := strconv.Atoi(s) - if err != nil { - panic(err) - } + checkErr(err) return n } // used to detect whether to auto-add a panic checker diff --git a/realm/discovery.gno b/realm/discovery.gno index 0ebc019..567a510 100644 --- a/realm/discovery.gno +++ b/realm/discovery.gno @@ -81,9 +81,7 @@ func GetPlayer(player string) string { panic("player not found") } b, err := v.(*Player).MarshalJSON() - if err != nil { - panic(err) - } + checkErr(err) return string(b) } @@ -282,9 +280,7 @@ func Leaderboard(category string) string { for idx, entry := range leaderboard[cat] { p, _ := playerStore.Get(entry.addr.String()) d, err := p.(Player).MarshalJSON() - if err != nil { - panic(err) - } + checkErr(err) buf.Write(d) if idx != len(leaderboard[cat])-1 { buf.WriteByte(',') @@ -420,9 +416,7 @@ func parseFilters(filters string) (r listGamesFilters) { r.minID = pred case "limit:": n, err := strconv.Atoi(pred) - if err != nil { - panic(err) - } + checkErr(err) r.limit = n case "sort:": r.reverse = pred == "desc"