Skip to content

fix: Gracefully handle missing raw button on GitHub file pages - #163

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graceful-missing-raw-button
Open

fix: Gracefully handle missing raw button on GitHub file pages#163
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graceful-missing-raw-button

Conversation

@sentry

@sentry sentry Bot commented Aug 26, 2026

Copy link
Copy Markdown

This PR addresses the Error: Raw button not found that occurs when the createCoverageButton function in src/content/github/file/main.tsx cannot find the expected raw button element on a GitHub file page.

Previously, if the raw button was not found (e.g., due to GitHub UI variations, timing issues in SPA navigation, or pages where the button is genuinely absent), the function would throw an error. This error, although handled by Sentry, would cause the entire extension processing for that page to crash, leading to a poor user experience and a high volume of Sentry events.

The fix implements the following changes:

  1. createCoverageButton modification: The function now returns undefined instead of throwing an error if the [data-testid="raw-button"] element is not found. The function's return type has been updated to HTMLElement | undefined.
  2. main() guard clause: A check has been added in the main() function. If createCoverageButton() returns undefined (meaning the raw button was not found), the main() function will now gracefully exit early, preventing further processing and avoiding any crashes.

This change ensures that the extension remains robust and does not crash on pages where the raw button is not present, while still functioning as expected on pages where it is available.

Fixes BROWSER-EXTENSION-1Q

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 84 bytes (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
codecov-browser-extension-array-push 660.55kB 84 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: codecov-browser-extension-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
background.js 89 bytes 207.75kB 0.04%
githubFile.js -5 bytes 11.46kB -0.04%

Files in githubFile.js:

  • ./src/content/github/file/main.tsx → Total Size: 11.79kB

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.

0 participants