try catch

This commit is contained in:
Niki Wix Skaarup 2025-04-02 01:58:31 +02:00
parent a04b54ce99
commit a4d5e5d768
Signed by: nikiskaarup
GPG key ID: FC2F1B116F6E788C

View file

@ -9,10 +9,14 @@
// Pooling interval to fetch entries every 31 seconds
interval = setInterval(async () => {
const promise = fetchEntries();
// wait for the promise to resolve before assigning to prevent flash
await promise;
entriesPromise = promise;
try {
const promise = fetchEntries();
// wait for the promise to resolve before assigning to prevent flash
await promise;
entriesPromise = promise;
} catch (error) {
console.error('Error fetching entries:', error);
}
}, 1000 * 31);
return () => clearInterval(interval);