Skip to content

Commit

Permalink
fix: Throws better error logs in cron for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
towfiqi committed Dec 8, 2022
1 parent 480767d commit a6af9d3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ const getAppSettings = async () => {
}
return decryptedSettings;
} catch (error) {
console.log(error);

// console.log('CRON ERROR: Reading Settings File. ', error);
await promises.writeFile(`${process.cwd()}/data/settings.json`, JSON.stringify(defaultSettings), { encoding: 'utf-8' });
return defaultSettings;
}
Expand Down Expand Up @@ -73,7 +72,7 @@ const runAppCronJobs = () => {
.then((res) => res.json())
.then((data) => console.log(data))
.catch((err) => {
console.log('ERROR Making Cron Request..');
console.log('ERROR Making Daily Scraper Cron Request..');
console.log(err);
});
}, { scheduled: true });
Expand All @@ -92,7 +91,7 @@ const runAppCronJobs = () => {
.then((res) => res.json())
.then((refreshedData) => console.log(refreshedData))
.catch((fetchErr) => {
console.log('ERROR Making Cron Request..');
console.log('ERROR Making failed_queue Cron Request..');
console.log(fetchErr);
});
}
Expand All @@ -115,7 +114,7 @@ const runAppCronJobs = () => {
.then((res) => res.json())
.then((data) => console.log(data))
.catch((err) => {
console.log('ERROR Making Cron Request..');
console.log('ERROR Making Cron Email Notification Request..');
console.log(err);
});
}, { scheduled: true });
Expand Down

0 comments on commit a6af9d3

Please sign in to comment.