everybody loves a refactor
This commit is contained in:
@@ -25,11 +25,12 @@ func SeasonPage(
|
||||
var err error
|
||||
season, err = db.GetSeason(ctx, tx, seasonStr)
|
||||
if err != nil {
|
||||
if db.IsBadRequest(err) {
|
||||
throw.NotFound(s, w, r, r.URL.Path)
|
||||
return false, nil
|
||||
}
|
||||
return false, errors.Wrap(err, "db.GetSeason")
|
||||
}
|
||||
if season == nil {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
leaguesWithTeams, err = season.MapTeamsToLeagues(ctx, tx)
|
||||
if err != nil {
|
||||
@@ -40,10 +41,6 @@ func SeasonPage(
|
||||
}); !ok {
|
||||
return
|
||||
}
|
||||
if season == nil {
|
||||
throw.NotFound(s, w, r, r.URL.Path)
|
||||
return
|
||||
}
|
||||
renderSafely(seasonsview.DetailPage(season, leaguesWithTeams), s, r, w)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user