Catch exception when trying to connect to update server

This commit is contained in:
Deon George 2024-01-14 13:02:16 +11:00
parent eda3680997
commit cb06f3dcb6

View File

@ -39,14 +39,20 @@ class CheckUpdate
$client = new Client; $client = new Client;
$response = $client->request('POST',sprintf('%s/%s',self::UPDATE_SERVER,strtolower(config('app.version')))); try {
if ($response->getStatusCode() === 200) { $response = $client->request('POST',sprintf('%s/%s',self::UPDATE_SERVER,strtolower(config('app.version'))));
$result = json_decode($response->getBody());
Log::debug(sprintf('CU_:- Update server returned...'),['update'=>$result]); if ($response->getStatusCode() === 200) {
$result = json_decode($response->getBody());
return $result; Log::debug(sprintf('CU_:- Update server returned...'),['update'=>$result]);
return $result;
}
} catch (\Exception $e) {
Log::debug(sprintf('CU_:- Exception connecting to update server'),['e'=>get_class($e)]);
} }
return NULL; return NULL;