Skip to content

Commit

Permalink
Merge pull request #26 from N-O-D-E-Community/hotfix-ts
Browse files Browse the repository at this point in the history
Hotfix to handle connection errors
  • Loading branch information
SageStarCodes authored May 17, 2018
2 parents 76b5010 + b25fde2 commit c56aa39
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ts-src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,20 @@ client.on("message", msg => {
}
});
// LOGIN
client.login(config.discord.token).catch(err => {
winston.error("Unable to login, please check \"config.json\"");
try {
client.login(config.discord.token).catch(err => {
winston.error("Unable to login, please check \"config.json\"");
winston.error(err);
process.exit(-1);
});
} catch (e) {
winston.error(e);
winston.info("Caught in try-catch, discarding, let's see what happens...");
}

client.on("error", err => {
winston.error(err);
process.exit(-1);
winston.info("Caught in 'on error', discarding, let's see what happens...");
});
/* END DISCORD.JS */
});

0 comments on commit c56aa39

Please sign in to comment.