Ensure consistent error handling and improve resource cleanup across widgets and APIs.

This commit is contained in:
2026-01-01 12:10:33 +01:00
parent af5a39ef75
commit 2a66278cae
9 changed files with 90 additions and 48 deletions
+1 -2
View File
@@ -28,8 +28,7 @@ func createWeather(ctx context.Context, _ terminalapi.Terminal, _ interface{}) w
weather := openWeatherMap.FetchCurrentWeather()
widget.Reset()
if weather.ErrorMessage != "" {
widget.Write(weather.ErrorMessage, text.WriteCellOpts(cell.FgColor(cell.ColorRed)))
return nil
return widget.Write(weather.ErrorMessage, text.WriteCellOpts(cell.FgColor(cell.ColorRed)))
}
weatherIcon := getIcon(weather.Weather[0].Icon)