diff --git a/package.json b/package.json index eb04081..ab95291 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "pr-validator", "version": "0.0.0", + "type": "module", "private": true, "scripts": { "deploy": "wrangler deploy", @@ -8,14 +9,13 @@ "start": "wrangler dev", "format": "prettier . --write" }, + "dependencies": { + "crypto-js": "^4.2.0", + "oauth-1.0a": "^2.2.6" + }, "devDependencies": { "itty-router": "^3.0.12", "prettier": "^3.3.2", "wrangler": "^3.0.0" - }, - "type": "module", - "dependencies": { - "crypto-js": "^4.2.0", - "oauth-1.0a": "^2.2.6" } } diff --git a/src/tests/SimilarWeb.js b/src/tests/SimilarWeb.js index a9abb7c..324b3f2 100644 --- a/src/tests/SimilarWeb.js +++ b/src/tests/SimilarWeb.js @@ -1,6 +1,6 @@ import logger from '../logger.js'; -const test = 'SimilarWeb'; +const test = 'Similarweb'; /** * Retrieve the Similarweb rank for a given domain @@ -26,8 +26,9 @@ export default async function (entryDomain, env, file) { } if (!res.ok) { - if (!file) throw new Error('Unable to fetch website rank'); - else logger.addWarning(file, `Unable to fetch website rank for additional domain ${domain}`); + 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}`); } const json = await res.json();