mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-10-18 03:51:56 +00:00
fix: bare except (#1159)
Bare `except:` catches SystemExit and KeyboardInterrupt, which can: - Mask Ctrl+C handling during long optimization runs - Hide critical system signals - Make debugging harder Replacement by `except Exception:` preserves the same error handling while respecting system-level exceptions. Co-authored-by: Milo @KeloYuan Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
co-authored by
Milo @KeloYuan
parent
6933b33542
commit
8bf798daeb
@@ -16,7 +16,7 @@ def elecprice_provider_ids() -> list[str]:
|
||||
"""Valid elecprice provider ids."""
|
||||
try:
|
||||
prediction_eos = get_prediction()
|
||||
except:
|
||||
except Exception:
|
||||
# Prediction may not be initialized
|
||||
# Return at least provider used in example
|
||||
return ["ElecPriceAkkudoktor"]
|
||||
|
||||
@@ -13,7 +13,7 @@ def feedintariff_provider_ids() -> list[str]:
|
||||
"""Valid feedintariff provider ids."""
|
||||
try:
|
||||
prediction_eos = get_prediction()
|
||||
except:
|
||||
except Exception:
|
||||
# Prediction may not be initialized
|
||||
# Return at least provider used in example
|
||||
return ["FeedInTariffFixed", "FeedInTarifImport"]
|
||||
|
||||
@@ -40,7 +40,7 @@ class FeedInTariffFixed(FeedInTariffProvider):
|
||||
feed_in_tariff = (
|
||||
self.config.feedintariff.provider_settings.FeedInTariffFixed.feed_in_tariff_kwh
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
logger.exception(error_msg)
|
||||
raise ValueError(error_msg)
|
||||
if feed_in_tariff is None:
|
||||
|
||||
@@ -16,7 +16,7 @@ def load_providers() -> list[str]:
|
||||
"""Valid load provider ids."""
|
||||
try:
|
||||
prediction_eos = get_prediction()
|
||||
except:
|
||||
except Exception:
|
||||
# Prediction may not be initialized
|
||||
# Return at least provider used in example
|
||||
return ["LoadAkkudoktor", "LoadVrm", "LoadImport"]
|
||||
|
||||
@@ -20,7 +20,7 @@ def pvforecast_provider_ids() -> list[str]:
|
||||
"""Valid PV forecast providers."""
|
||||
try:
|
||||
prediction_eos = get_prediction()
|
||||
except:
|
||||
except Exception:
|
||||
# Prediction may not be initialized
|
||||
# Return at least provider used in example
|
||||
return [
|
||||
|
||||
@@ -14,7 +14,7 @@ def weather_provider_ids() -> list[str]:
|
||||
"""Valid weather provider ids."""
|
||||
try:
|
||||
prediction_eos = get_prediction()
|
||||
except:
|
||||
except Exception:
|
||||
# Prediction may not be initialized
|
||||
# Return at least provider used in example
|
||||
return ["WeatherImport"]
|
||||
|
||||
Reference in New Issue
Block a user