fix: error handling

This commit is contained in:
Cory Dransfeldt 2024-04-15 13:44:44 -07:00
parent b324dc6b29
commit 5ee77b32f0
No known key found for this signature in database
3 changed files with 10 additions and 4 deletions

View file

@ -62,7 +62,13 @@ export const onPreBuild = async ({ constants }) => {
}
for (const key of yearKeys) {
const scrobbleData = await scrobbles.get(key, { type: 'json'})
let scrobbleData;
try {
scrobbleData = await scrobbles?.get(key, { type: 'json'})
} catch (error) {
console.log("Error: can't get more scrobbles.")
break;
}
yearChartData['data'].push(...scrobbleData['data'])
}