Skip to content

Commit 23aa89a

Browse files
author
Michael Babker
committed
Missed on try/catch
1 parent a56f449 commit 23aa89a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

administrator/components/com_patchtester/PatchTester/Controller/StartfetchController.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,23 @@ public function execute()
4444

4545
// Make sure we can fetch the data from GitHub - throw an error on < 10 available requests
4646
$github = Helper::initializeGithub();
47-
$rate = $github->authorization->getRateLimit();
47+
48+
try
49+
{
50+
$rate = $github->authorization->getRateLimit();
51+
}
52+
catch (\Exception $e)
53+
{
54+
$response = new \JResponseJson(
55+
new \Exception(
56+
\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage())
57+
)
58+
);
59+
60+
echo json_encode($response);
61+
62+
$this->getApplication()->close(1);
63+
}
4864

4965
// If over the API limit, we can't build this list
5066
if ($rate->resources->core->remaining < 10)

0 commit comments

Comments
 (0)