Skip to content

fix(api): raise HTTPError instead of returning None on API errors#1213

Open
MD-Mushfiqur123 wants to merge 1 commit into
mlco2:masterfrom
MD-Mushfiqur123:master
Open

fix(api): raise HTTPError instead of returning None on API errors#1213
MD-Mushfiqur123 wants to merge 1 commit into
mlco2:masterfrom
MD-Mushfiqur123:master

Conversation

@MD-Mushfiqur123
Copy link
Copy Markdown

Resolves #820

Changes:

  • Replaced _log_error() + return None pattern with r.raise_for_status() in all ApiClient methods
  • Removed unused _log_error method
  • Removed None-check in check_organization_exists (method now raises on HTTP errors)
  • add_emission and _create_run already have try/except wrappers so they continue to handle errors gracefully (logging + returning False/None)
  • CodeCarbonAPIOutput (used by EmissionsTracker) already wraps add_emission in try/except
  • Updated tests to expect requests.HTTPError instead of None returns

@MD-Mushfiqur123 MD-Mushfiqur123 requested a review from a team as a code owner May 28, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API client to throw error instead of None

1 participant