-
Notifications
You must be signed in to change notification settings - Fork 3
[TD-009] Inconsistent error returns (empty list vs raise) #10
Copy link
Copy link
Open
Description
Description
Some functions return empty lists on error, others raise exceptions. collect_azure_costs returns empty list but collect_gcp_costs raises.
Location
- File:
cost_collect.pyaround line 324-330
Impact
- Inconsistent error handling makes debugging harder
- Callers must handle both cases
- Potential for silent failures
Suggested Fix
Standardize approach - prefer raising with descriptive message:
# Instead of:
except Exception as e:
logger.error(f"Failed to collect costs: {e}")
return []
# Prefer:
except Exception as e:
raise CostCollectionError(f"Failed to collect Azure costs: {e}") from ePriority
Medium
Source
TECH_DEBT.md - TD-009
Reactions are currently unavailable