Improved error handling

This commit is contained in:
2016-11-23 14:26:59 +09:00
parent da96ad60e7
commit 73b68c0a0f
7 changed files with 12 additions and 20 deletions

View File

@ -10,20 +10,12 @@ import (
// Get ...
func Get(ctx *aero.Context) string {
var animeList []*arn.Anime
animeList, err := arn.GetAiringAnime()
scan := make(chan *arn.Anime)
arn.Scan("Anime", scan)
for anime := range scan {
if anime.AiringStatus != "currently airing" || anime.Adult {
continue
}
animeList = append(animeList, anime)
if err != nil {
return ctx.Error(500, "Failed fetching airing anime", err)
}
sort.Sort(arn.AnimeByPopularity(animeList))
return ctx.HTML(components.Airing(animeList))
}