From f4084e42d69007ff0170af362ac28109ed68392b Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:29:11 -0500 Subject: [PATCH] lint --- src/plugins/code-reference.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/code-reference.js b/src/plugins/code-reference.js index ebd9e2a9cc..96d68c8228 100644 --- a/src/plugins/code-reference.js +++ b/src/plugins/code-reference.js @@ -132,7 +132,9 @@ function getCodeSnippet({ code, lines, snippetName }) { async function fetchSnippet(url, { lines, snippetName }) { const codeResponse = await fetch(url); if (!codeResponse.ok) { - throw new Error(`Failed to fetch code from ${url}: ${codeResponse.statusText}`); + throw new Error( + `Failed to fetch code from ${url}: ${codeResponse.statusText}`, + ); } const code = await codeResponse.text(); const snippet = getCodeSnippet({ code, lines, snippetName }); @@ -196,7 +198,12 @@ function plugin() { } node.value = snippet; } catch (error) { - console.error(`Error processing snippet from ${url}:`, error.message); + // Log the error for debugging + console.error( + `Error processing snippet from ${url}:`, + error.message, + ); + // Re-throw the error to propagate it throw error; } })();