From c68088e15f9d65512d972fba1df6bdf7de8c1bb9 Mon Sep 17 00:00:00 2001 From: "H. Kamran" Date: Tue, 17 Dec 2024 09:35:35 -0800 Subject: [PATCH] Exit early if a request is not OK (#6) --- src/tests/SimilarWeb.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tests/SimilarWeb.js b/src/tests/SimilarWeb.js index 324b3f2..1f7a7b6 100644 --- a/src/tests/SimilarWeb.js +++ b/src/tests/SimilarWeb.js @@ -29,6 +29,8 @@ export default async function (entryDomain, env, file) { const errorDetails = `HTTP error ${res.status}\nError message: ${await res.text()}`; if (!file) throw new Error(`Unable to fetch website rank — ${errorDetails}`); else logger.addWarning(file, `Unable to fetch website rank for additional domain ${domain} — ${errorDetails}`); + + return 1; } const json = await res.json();