improvement: move sentry config to .env

This commit is contained in:
canove
2020-08-13 17:58:37 -03:00
parent 7850a0cdfa
commit 5b429bda87
4 changed files with 25 additions and 15 deletions

View File

@@ -2,6 +2,7 @@ const path = require("path");
const fs = require("fs");
const { Op } = require("sequelize");
const { subHours } = require("date-fns");
const Sentry = require("@sentry/node");
const Contact = require("../models/Contact");
const Ticket = require("../models/Ticket");
@@ -149,6 +150,7 @@ const wbotMessageListener = () => {
await handleMessage(msg, ticket, contact);
} catch (err) {
Sentry.captureException(err);
console.log(err);
}
});
@@ -171,6 +173,7 @@ const wbotMessageListener = () => {
message: messageToUpdate,
});
} catch (err) {
Sentry.captureException(err);
console.log(err);
}
});

View File

@@ -1,3 +1,5 @@
const Sentry = require("@sentry/node");
const Whatsapp = require("../models/Whatsapp");
const wbotMessageListener = require("./wbotMessageListener");
@@ -19,6 +21,7 @@ const wbotMonitor = () => {
try {
await Whatsapp.update({ battery, plugged }, { where: { id: 1 } });
} catch (err) {
Sentry.captureException(err);
console.log(err);
}
@@ -34,7 +37,10 @@ const wbotMonitor = () => {
wbotMessageListener();
wbotMonitor();
})
.catch(err => console.log(err)),
.catch(err => {
Sentry.captureException(err);
console.log(err);
}),
2000
);
});
@@ -43,6 +49,7 @@ const wbotMonitor = () => {
// wbot.resetState();
// }, 20000);
} catch (err) {
Sentry.captureException(err);
console.log(err);
}
};