From 0decb9dcb4ddf90b6bf7967fab43dc13d69285ab Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sun, 18 Feb 2018 07:36:17 -0800 Subject: [PATCH] return error info after finding feeds if available --- lib/XRay/Feeds.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/XRay/Feeds.php b/lib/XRay/Feeds.php index d34f0b9..d6ad659 100644 --- a/lib/XRay/Feeds.php +++ b/lib/XRay/Feeds.php @@ -35,11 +35,19 @@ class Feeds { $url = normalize_url($url); $result = $this->http->get($url); + + if(isset($result['error']) && $result['error']) { + return [ + 'error' => $result['error'], + 'error_description' => $result['error_description'] + ]; + } + $body = $result['body']; $feeds = []; - // First check the content type of the response + // First check the content type of the response $contentType = isset($result['headers']['Content-Type']) ? $result['headers']['Content-Type'] : ''; if(is_array($contentType)) @@ -110,7 +118,7 @@ class Feeds { return [ 'url' => $result['url'], 'code' => $result['code'], - 'feeds' => $feeds + 'feeds' => $feeds, ]; }