Skip to content

Commit

Permalink
fix: Resolve sentry.json
Browse files Browse the repository at this point in the history
  • Loading branch information
schw4rzlicht committed Jun 14, 2020
1 parent 03d4cba commit 4f60c91
Showing 1 changed file with 27 additions and 32 deletions.
59 changes: 27 additions & 32 deletions src/lib/sentry.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
import Sentry = require("@sentry/node");
import fs = require("fs");
import {flush} from "@sentry/node";

export function init(packageInformation: any) {
try {
const sentry = JSON.parse(fs.readFileSync("./sentry.json", {encoding: "utf-8"}));

if (sentry) {

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});
}
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) {
}
Expand Down

0 comments on commit 4f60c91

Please sign in to comment.