Catch errors in calendar fetching
This commit is contained in:
		@@ -148,8 +148,12 @@ $ical = new ICal(options: [
 | 
			
		||||
	'defaultWeekStart' => 'MO',
 | 
			
		||||
	'filterDaysBefore' => '1',
 | 
			
		||||
]);
 | 
			
		||||
$ical->initUrl(ICAL_URL, userAgent: 'dorf.jetzt', acceptLanguage: 'de');
 | 
			
		||||
$events = $ical->eventsFromInterval('2 week') or [];
 | 
			
		||||
try {
 | 
			
		||||
	$ical->initUrl(ICAL_URL, userAgent: 'dorf.jetzt', acceptLanguage: 'de');
 | 
			
		||||
	$events = $ical->eventsFromInterval('2 week');
 | 
			
		||||
} catch (\Exception $e){
 | 
			
		||||
	$events = [];
 | 
			
		||||
}
 | 
			
		||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
 | 
			
		||||
	$locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
 | 
			
		||||
	setlocale(LC_TIME, $locale);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user