Skip to content

Commit

Permalink
Fixes unhandled promise rejections crashing the application on node.j…
Browse files Browse the repository at this point in the history
…s 8.6.x
  • Loading branch information
dscalzi committed Oct 6, 2017
1 parent 8796746 commit 19de4ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ app.post("/api/webhooks/:webhookID/:webhookSecret/:from", async function (req, r

if (typeof providers[provider] !== 'undefined') {
const instance = new providers[provider]();
discordPayload = await instance.parse(req);
try {
discordPayload = await instance.parse(req);
} catch (error) {
console.log('Error during parse:', error);
res.sendStatus(500);
//Winston doesn't log errors?? winston.error(error)
}
} else {
winston.error('Unknown provider "' + provider + '"');
}
Expand Down

0 comments on commit 19de4ca

Please sign in to comment.