From c41900efa935618fd2d5e41ee56473fb62e944e4 Mon Sep 17 00:00:00 2001 From: dabbott Date: Sun, 7 Feb 2021 10:44:31 +0200 Subject: [PATCH] Throw errors properly --- index.js | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 274c5e1..80d5446 100644 --- a/index.js +++ b/index.js @@ -7,13 +7,13 @@ gotify = { priority: 5, send: (title,message, priority) => { if (gotify.url == ""){ - throw "gotify url value empty, please use: gotify.url == 'https://gotify.mydomain.tld'" + throw new Error("gotify url value empty, please use: gotify.url == 'https://gotify.mydomain.tld'") } else if(gotify.token == "") { - throw "gotify url value empty, please use: gotify.token == 'xyzxyz'" + throw new Error("gotify url value empty, please use: gotify.token == 'xyzxyz'") } else if(message === undefined) { - throw "gotify message value was undefined" + throw new Error("gotify message value was undefined") } else if(title === undefined) { - throw "gotify title value was undefined" + throw new Error("gotify title value was undefined") } else { if (!priority){ priority = gotify.priority diff --git a/package.json b/package.json index 6a304af..c035807 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jotify", - "version": "1.0.1", + "version": "1.0.2", "description": "A dead simple gotify library for sending arbitrary messages in JS", "main": "index.js", "scripts": {