diff options
Diffstat (limited to 'app/AnimeStats.php')
| -rw-r--r-- | app/AnimeStats.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/app/AnimeStats.php b/app/AnimeStats.php index a4f3396..9b9b850 100644 --- a/app/AnimeStats.php +++ b/app/AnimeStats.php @@ -94,9 +94,16 @@ class AnimeStats extends Model { $this->season_name= $season_name; } - $animeInfo = $jikan->getAnime( - (new \Jikan\Request\Anime\AnimeRequest( $this->mal_id )) - ); + try { + $animeInfo = $jikan->getAnime( + (new \Jikan\Request\Anime\AnimeRequest( $this->mal_id )) + ); + } catch (\Exception $e) { + echo "Error requesting AnimeInfo for " . $this->mal_id ."\n"; + echo "Message: " . $e->getMessage(); + echo "\n\n"; + return false; + } $this->score = $animeInfo->getScore(); $this->scored_by = $animeInfo->getScoredBy(); $this->rank = $animeInfo->getRank(); @@ -112,7 +119,7 @@ class AnimeStats extends Model { echo "Error requesting AnimeStats for " . $this->mal_id ."\n"; echo "Message: " . $e->getMessage(); echo "\n\n"; - return; + return false; } $this->watching = $animeStats->getWatching(); @@ -173,6 +180,8 @@ class AnimeStats extends Model { } else { $this->score_10 = 0; } + + return true; } public function anime() { |
