Some fixes

This commit is contained in:
Sefinek 2024-08-18 17:03:51 +02:00
parent 51dec399d1
commit a5ac3ce6b2

View file

@ -22,10 +22,11 @@ const fetchBlockedIPs = async () => {
log('info', `Fetched ${events.length} events from Cloudflare`); log('info', `Fetched ${events.length} events from Cloudflare`);
return events; return events;
} else { } else {
console.log(res.data?.errors);
throw new Error(`Failed to retrieve data from Cloudflare. Status: ${res.status}`); throw new Error(`Failed to retrieve data from Cloudflare. Status: ${res.status}`);
} }
} catch (err) { } catch (err) {
log('error', err.response ? `${err.response.status} HTTP ERROR (Cloudflare API)\n${JSON.stringify(err.response.data, null, 2)}` : `Unknown error with Cloudflare API: ${err.message}`); log('error', err.response?.data ? `${err.response.status} HTTP ERROR (Cloudflare API)\n${JSON.stringify(err.response.data, null, 2)}` : `Unknown error with Cloudflare API: ${err.message}`);
return null; return null;
} }
}; };