twitch2ma
Version:
Twitch chat bot that runs commands on the MA GrandMA2 using Telnet.
53 lines • 1.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.sentryMessage = exports.init = void 0;
const Sentry = require("@sentry/node");
function init(packageInformation) {
try {
const sentry = require("../../sentry.json");
const os = require("os");
Sentry.init({
dsn: sentry.dsn,
environment: process.env.NODE_ENV ? process.env.NODE_ENV : "development",
release: 'twitch2ma@' + packageInformation.version,
integrations: [
new Sentry.Integrations.OnUncaughtException(),
new Sentry.Integrations.OnUnhandledRejection()
],
debug: process.env.NODE_ENV === "development"
});
Sentry.setContext("os", {
name: os.platform(),
version: os.release()
});
Sentry.setContext("runtime", {
name: process.release.name,
version: process.version
});
if (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "staging") {
Sentry.setUser({ username: os.userInfo().username });
}
}
catch (ignored) {
}
}
exports.init = init;
function sentry(error, messageHandler) {
Sentry.captureException(error);
return flushSentry()
.then(() => {
if (messageHandler) {
messageHandler(error);
}
});
}
exports.default = sentry;
function sentryMessage(message, severity) {
Sentry.captureMessage(message, severity);
return flushSentry();
}
exports.sentryMessage = sentryMessage;
function flushSentry() {
return Sentry.flush().catch(() => Promise.resolve());
}
//# sourceMappingURL=sentry.js.map