From d4e365c55d7a512f8e9a185faf3455af1a03a076 Mon Sep 17 00:00:00 2001 From: Shaun O'Neill Date: Fri, 14 Jul 2023 23:27:30 +0100 Subject: [PATCH] Use cloudflare to get the public IP (#3) --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 6fc0b46..a9d2ad0 100644 --- a/src/index.js +++ b/src/index.js @@ -27,7 +27,7 @@ const start = async () => { const isCloudflareTokenValid = await verifyCloudflareToken(); if (!isCloudflareTokenValid) { console.log('Cloudflare API key is invalid. Exiting', isCloudflareTokenValid); - throw new Error('Stopping job.') + throw new Error('Cloudflare API key is invalid'); } // Find out the TLD of the DNS_URL @@ -51,7 +51,7 @@ const start = async () => { if (!zone) { sendWebhookRequest({ status: 'error', message: `Unable to find zone for ${PARSED_TLD}. Please ensure that the domain is registered with Cloudflare.` }); console.log(`Unable to find zone for ${PARSED_TLD}. Please ensure that the domain is registered with Cloudflare.`); - throw new Error('Stopping job.') + throw new Error('Unable to find zone for ${PARSED_TLD}') } console.log(`Successfully Found Zone: ${zone.name} (${zone.id})`); @@ -106,7 +106,7 @@ const start = async () => { console.log('Completed, waiting for next scheduled run...\n'); } catch (error) { - console.error('An uncaught error occurred while running. The job will be stopped.', error); + console.error('An error occurred while running. The job will be stopped.', error); sendWebhookRequest({ status: 'error', message: 'An uncaught error occurred while running. The job will be stopped.', error }); job.stop(); }