Add error handling to weather widget
- Wrap getCurrentWeather() in try-catch block - Prevents white screen if weather API fails - Shows error message in widget instead - Add test-weather.php for debugging
This commit is contained in:
@@ -2644,7 +2644,11 @@ body.theme-neo footer {
|
||||
<!-- WEATHER WIDGET -->
|
||||
<?php if ($settingsManager->isWeatherEnabled()): ?>
|
||||
<?php
|
||||
$weather = $weatherManager->getCurrentWeather();
|
||||
try {
|
||||
$weather = $weatherManager->getCurrentWeather();
|
||||
} catch (Exception $e) {
|
||||
$weather = ['error' => 'Fehler: ' . $e->getMessage()];
|
||||
}
|
||||
if ($weather && !isset($weather['error'])):
|
||||
?>
|
||||
<div id="weather-widget" class="weather-widget">
|
||||
|
||||
Reference in New Issue
Block a user