Error catching when user doesn't have config.ini

This commit is contained in:
Stephen Vanderwarker 2021-12-12 09:15:09 -05:00
parent 27678bdbf8
commit 6bcd1c1e38

View File

@ -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");
}