-
-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Description
Summary
The main loop exception handlers in GECloud, GECloudData, Fox, and Octopus API clients silently swallow exceptions - they log them but don't track them for monitoring purposes. This makes it difficult to detect when API clients are experiencing repeated errors.
Problem
When an exception occurs in any of these main loops:
- GECloud (
apps/predbat/gecloud.py:875) - GECloudData (
apps/predbat/gecloud.py:1455) - Fox API (
apps/predbat/fox.py:142) - Octopus API (
apps/predbat/octopus.py:440)
The error is logged but:
failures_totalcounter is not incremented (inconsistent with API request failures)had_errorsflag is not set (so monitoring systems can't detect issues)
Impact
- Monitoring systems can't alert on repeated main loop exceptions
- The error metrics stay at 0 even when errors are occurring repeatedly
- Makes it hard to detect and diagnose issues like the recent EVC device bug (GECloud: async_get_evc_device missing 'previous' parameter causes TypeError #2931)
Proposed Solution
Add error tracking to each main loop exception handler:
except Exception as e:
self.log("Error: ... {}".format(e))
self.failures_total += 1
if hasattr(self.base, 'had_errors'):
self.base.had_errors = TrueThis ensures:
- API failure metrics are incremented (consistent with other API failure tracking)
- General error flag is set for monitoring systems that check
had_errors - Uses
hasattr()check for backwards compatibility
Metadata
Metadata
Assignees
Labels
No labels