microsoft / microsoft/Web-Dev-For-Beginners

browser-extension project: Add Fallback for Missing API Response Data

Open
#1,548 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

no-issue-activity
Dominant language
JavaScript
Stars
96.7k
Forks
15.9k
PR merge metrics
No merged PRs in 30d

Description

The displayCarbonUsage function assumes response.data.data contains carbonIntensity and fossilFuelPercentage, but missing data could cause errors. Adding checks (e.g., if (response.data.data?.carbonIntensity == null) { throw new Error('Missing carbon intensity data'); }) would prevent runtime errors and allow for graceful fallback (e.g., displaying “Data unavailable” for missing fields).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the browser-extension code for displayCarbonUsage and inspect how response.data.data is read. Trace the current handling of absent carbonIntensity and fossilFuelPercentage values, then decide on consistent fallback behavior from the issue’s requirements. Done means missing API fields no longer cause an unhandled runtime error and the unavailable data is handled visibly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.