From 27b6f7c61e35a7dd365240da5870f98041bf05de Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 10:49:17 +0000 Subject: [PATCH] fix: Gracefully handle missing raw button on GitHub file pages --- src/content/github/file/main.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/content/github/file/main.tsx b/src/content/github/file/main.tsx index 0e81545..8f8dbd4 100644 --- a/src/content/github/file/main.tsx +++ b/src/content/github/file/main.tsx @@ -79,6 +79,7 @@ async function main(): Promise { return; } globals.coverageButton = createCoverageButton(); + if (!globals.coverageButton) return; await process(urlMetadata); } catch (e) { if (Sentry) { @@ -291,10 +292,10 @@ async function process(metadata: FileMetadata): Promise { animateAndAnnotateLines(noVirtLineSelector, annotateLine); } -function createCoverageButton() { +function createCoverageButton(): HTMLElement | undefined { const rawButton = document.querySelector('[data-testid="raw-button"]'); if (!rawButton) { - throw new Error("Raw button not found"); + return undefined; } const codecovButton = rawButton.cloneNode(true) as HTMLElement; codecovButton.addEventListener("click", (event) => {