Skip to content

Commit

Permalink
fix🐛: add try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
isboyjc committed Aug 1, 2024
1 parent 9f2a7c2 commit a8f8f2d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions script/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,27 @@ function delay(ms) {
}

(async () => {
await run('daily', 'all')
await run('weekly', 'all')
await run('monthly', 'all')
try {
await run('daily', 'all')
await run('weekly', 'all')
await run('monthly', 'all')
} catch (error) {
console.error('Error language all:', error);
}

let languages = readFileSync(path.resolve(__dirname, DATA_BASE_URL, 'languages.json'), 'utf8');
languages = JSON.parse(languages);

console.log("Number of languages: ", languages.length)

for(const langObj of languages){
await delay(5 * 60)
await run('daily', convertToSlug(langObj.name))
await run('weekly', convertToSlug(langObj.name))
await run('monthly', convertToSlug(langObj.name))
try {
await delay(5 * 60)
await run('daily', convertToSlug(langObj.name))
await run('weekly', convertToSlug(langObj.name))
await run('monthly', convertToSlug(langObj.name))
} catch (error) {
console.error(`Error language ${convertToSlug(langObj.name)}:`, error);
}
}
})();

0 comments on commit a8f8f2d

Please sign in to comment.