diff --git a/functions/webhooks/ask.js b/functions/webhooks/ask.js index 8cfcee0..08521eb 100644 --- a/functions/webhooks/ask.js +++ b/functions/webhooks/ask.js @@ -1,5 +1,9 @@ module.exports = async (req, res) => { - const { question, answer } = JSON.parse(req.body); - console.info(`[RECEIVED]\tWEBHOOKS/ASK\tQ:${question}\tA:${answer}`); - res.status(200).send({ message: 'Got answer.' }); + try { + const { question, answer } = JSON.parse(req.body); + console.info(`[RECEIVED]\tWEBHOOKS/ASK\tQ:${question}\tA:${answer}`); + res.status(200).send({ message: "Got answer." }); + } catch (e) { + console.info(`[ERROR]\tWEBHOOKS/ASK/Failed To Parse\tBody:${req.body}`); + } };