From 23aa89ae9d0cacbe27668b37f66674b88aa2ccd9 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sat, 9 May 2015 12:58:58 -0400 Subject: [PATCH] Missed on try/catch --- .../Controller/StartfetchController.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php b/administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php index a492aa8..00c2db7 100644 --- a/administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php +++ b/administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php @@ -44,7 +44,23 @@ class StartfetchController extends DisplayController // Make sure we can fetch the data from GitHub - throw an error on < 10 available requests $github = Helper::initializeGithub(); - $rate = $github->authorization->getRateLimit(); + + try + { + $rate = $github->authorization->getRateLimit(); + } + catch (\Exception $e) + { + $response = new \JResponseJson( + new \Exception( + \JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()) + ) + ); + + echo json_encode($response); + + $this->getApplication()->close(1); + } // If over the API limit, we can't build this list if ($rate->resources->core->remaining < 10)