Skip to content

[TD-009] Inconsistent error returns (empty list vs raise) #10

@LFigg

Description

@LFigg

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.py around 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 e

Priority

Medium

Source

TECH_DEBT.md - TD-009

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions