From 81b50b1cd9ad4f51bbafe1ab35b999f82d04a807 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 1 Jul 2024 13:03:18 +0200 Subject: [PATCH 1/2] zinnia: report source update errors to sentry --- lib/zinnia.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/zinnia.js b/lib/zinnia.js index a483e80e..a94a8199 100644 --- a/lib/zinnia.js +++ b/lib/zinnia.js @@ -33,11 +33,11 @@ export const install = () => installBinaryModule({ ] }) -let lastCrashReportedAt = 0 +let lastErrorReportedAt = 0 const maybeReportErrorToSentry = (/** @type {unknown} */ err) => { const now = Date.now() - if (now - lastCrashReportedAt < 4 /* HOURS */ * 3600_000) return - lastCrashReportedAt = now + if (now - lastErrorReportedAt < 4 /* HOURS */ * 3600_000) return + lastErrorReportedAt = now /** @type {Parameters[1]} */ const hint = { extra: {} } @@ -91,6 +91,7 @@ const updateAllSourceFiles = async ({ onFailedAttempt: err => { console.error(err) console.error(`Failed to download ${module} source. Retrying...`) + maybeReportErrorToSentry(err) if (String(err).includes('You are being rate limited')) { const delaySeconds = 30 + (Math.random() * 60) // Don't DDOS the w3name services From 821c29584169b832b1437cd8bc9d85c227b0e2f6 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Tue, 2 Jul 2024 04:54:10 -0700 Subject: [PATCH 2/2] Update lib/zinnia.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Miroslav Bajtoš --- lib/zinnia.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/zinnia.js b/lib/zinnia.js index a94a8199..fa20b843 100644 --- a/lib/zinnia.js +++ b/lib/zinnia.js @@ -90,8 +90,9 @@ const updateAllSourceFiles = async ({ retries: 10, onFailedAttempt: err => { console.error(err) - console.error(`Failed to download ${module} source. Retrying...`) - maybeReportErrorToSentry(err) + const msg = `Failed to download ${module} source. Retrying...` + console.error(msg) + maybeReportErrorToSentry(new Error(msg, { cause: err })) if (String(err).includes('You are being rate limited')) { const delaySeconds = 30 + (Math.random() * 60) // Don't DDOS the w3name services