diff --git a/includes/pages/schedule/ImportSchedule.php b/includes/pages/schedule/ImportSchedule.php index 44feac37..2d01dcf2 100644 --- a/includes/pages/schedule/ImportSchedule.php +++ b/includes/pages/schedule/ImportSchedule.php @@ -21,6 +21,7 @@ use Engelsystem\Models\Shifts\ShiftType; use Engelsystem\Models\User\User; use ErrorException; use GuzzleHttp\Client as GuzzleClient; +use GuzzleHttp\Exception\ConnectException; use Illuminate\Database\Connection as DatabaseConnection; use Illuminate\Database\Eloquent\Builder as QueryBuilder; use Illuminate\Database\Eloquent\Collection as DatabaseCollection; @@ -445,7 +446,12 @@ class ImportSchedule extends BaseController /** @var ScheduleUrl $scheduleUrl */ $scheduleUrl = ScheduleUrl::findOrFail($scheduleId); - $scheduleResponse = $this->guzzle->get($scheduleUrl->url); + try { + $scheduleResponse = $this->guzzle->get($scheduleUrl->url); + } catch (ConnectException $e) { + throw new ErrorException('schedule.import.request-error'); + } + if ($scheduleResponse->getStatusCode() != 200) { throw new ErrorException('schedule.import.request-error'); } diff --git a/resources/views/admin/schedule/index.twig b/resources/views/admin/schedule/index.twig index 2d6b00cd..abb12e28 100644 --- a/resources/views/admin/schedule/index.twig +++ b/resources/views/admin/schedule/index.twig @@ -35,7 +35,7 @@ {% for schedule in schedules %}