From 6bcd1c1e3886094044a73cb351c38127fb4cf378 Mon Sep 17 00:00:00 2001 From: stephen Date: Sun, 12 Dec 2021 09:15:09 -0500 Subject: [PATCH] Error catching when user doesn't have config.ini --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index ac30e9a..fdbbea1 100755 --- a/index.js +++ b/index.js @@ -7,6 +7,10 @@ let Parser = require('rss-parser'); let parser = new Parser(); const xmpp = require('simple-xmpp'); +try { + fs.readFileSync('./config.ini', 'utf-8'); + + const config = ini.parse(fs.readFileSync('./config.ini', 'utf-8')); const api_pass = config.api_pass; const api_url = config.api_url; @@ -266,3 +270,6 @@ xmpp.connect({ // Checks the XMPP server for new 'friend' requests console.log(xmpp.getRoster()); +} catch(e) { + console.log("Please create a config.ini"); +} \ No newline at end of file