Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
feat: adds additional manifest attempt logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cujarrett committed Mar 10, 2021
1 parent 04c9adb commit 7c4e4e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/routes/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" } }
}
})
}

0 comments on commit 7c4e4e6

Please sign in to comment.