diff --git a/lib/notification/adapter/ntfy.js b/lib/notification/adapter/ntfy.js index e217580..8a45bd0 100644 --- a/lib/notification/adapter/ntfy.js +++ b/lib/notification/adapter/ntfy.js @@ -36,7 +36,17 @@ Link: ${newListing.link}`; method: 'POST', headers, body: message, - }); + }) + .then((res) => { + if (!res.ok) { + throw new Error(`Ntfy message could not be sent. Status code: ${res.status}`); + } + return res.text(); + }) + .catch((error) => { + // Ensure we reject with an Error object and prevent unhandled rejections + throw error instanceof Error ? error : new Error(String(error)); + }); }); return Promise.all(promises);