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) => {