diff --git a/lib/XRay/Fetcher.php b/lib/XRay/Fetcher.php index 608baea..3e37789 100644 --- a/lib/XRay/Fetcher.php +++ b/lib/XRay/Fetcher.php @@ -145,19 +145,7 @@ class Fetcher { ]; } - $tweet = Formats\Twitter::fetch($url, $creds); - if(!$tweet) { - return [ - 'error' => 'twitter_error', - 'error_description' => $e->getMessage() - ]; - } - - return [ - 'url' => $url, - 'body' => $tweet, - 'code' => 200, - ]; + return Formats\Twitter::fetch($url, $creds); } private function _fetch_github($url, $opts) { diff --git a/lib/XRay/Formats/Twitter.php b/lib/XRay/Formats/Twitter.php index 7462dd5..db2fd9c 100644 --- a/lib/XRay/Formats/Twitter.php +++ b/lib/XRay/Formats/Twitter.php @@ -33,10 +33,17 @@ class Twitter extends Format { try { $tweet = $twitter->request('statuses/show/'.$tweet_id, 'GET', ['tweet_mode'=>'extended']); } catch(\TwitterException $e) { - return false; + return [ + 'error' => 'twitter_error', + 'error_description' => $e->getMessage() + ]; } - return $tweet; + return [ + 'url' => $url, + 'body' => $tweet, + 'code' => 200, + ]; } public static function parse($json, $url) {