From 7c4e4e614d523011394ed3b45652941deda1db71 Mon Sep 17 00:00:00 2001 From: Matt Jarrett Date: Wed, 10 Mar 2021 15:45:53 -0600 Subject: [PATCH] feat: adds additional manifest attempt logging --- package-lock.json | 26 +++++++++++++------------- src/routes/info.js | 7 ++++--- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1595303..3a3c354 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "requires": true, "packages": { "": { - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "dependencies": { "lambda-api": "~0.10.6", @@ -8768,7 +8768,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz", "integrity": "sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -8788,7 +8788,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -8796,7 +8796,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz", "integrity": "sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -8804,7 +8804,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/lodash._createcache/-/lodash._createcache-3.1.2.tgz", "integrity": "sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8823,7 +8823,7 @@ "version": "3.9.1", "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -8847,7 +8847,7 @@ "version": "3.6.1", "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -21410,7 +21410,7 @@ "resolved": "https://registry.npmjs.org/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz", "integrity": "sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=", "bundled": true, - "dev": true + "extraneous": true }, "lodash._baseuniq": { "version": "4.6.0", @@ -21428,21 +21428,21 @@ "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=", "bundled": true, - "dev": true + "extraneous": true }, "lodash._cacheindexof": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz", "integrity": "sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=", "bundled": true, - "dev": true + "extraneous": true }, "lodash._createcache": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/lodash._createcache/-/lodash._createcache-3.1.2.tgz", "integrity": "sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=", "bundled": true, - "dev": true, + "extraneous": true, "requires": { "lodash._getnative": "^3.0.0" } @@ -21459,7 +21459,7 @@ "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", "bundled": true, - "dev": true + "extraneous": true }, "lodash._root": { "version": "3.0.1", @@ -21480,7 +21480,7 @@ "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", "bundled": true, - "dev": true + "extraneous": true }, "lodash.union": { "version": "4.6.0", diff --git a/src/routes/info.js b/src/routes/info.js index 2205ea4..d1c80e5 100644 --- a/src/routes/info.js +++ b/src/routes/info.js @@ -46,14 +46,15 @@ module.exports = async (api) => { let manifestRetries = 0 if (!isValidManifestData) { while (manifestRetries < maxRetries && !isValidManifestData) { + manifestRetries += 1 + console.log({ manifestRetries }) rawManifest = await fetch("https://www.bungie.net/Platform/Destiny2/Manifest/") manifestData = await rawManifest.json() isValidManifestData = manifestData.Message === "Ok" - manifestRetries += 1 } if (manifestRetries === maxRetries && !isValidManifestData) { - throw new Error("Manifest failed") + return { metadata: { error: `The Bungie manifest failed to load ${maxRetries} times` } } } } // eslint-disable-next-line max-len @@ -144,7 +145,7 @@ ${JSON.stringify(result, null, " ")}`) return JSON.stringify(result, null, " ") } catch (error) { console.log(error) - return { errorMessage: "An error has occurred" } + return { metadata: { error: "An error has occurred" } } } }) }