Add sentry integration (#1141)

This commit is contained in:
Kostas Bariotis 2020-03-31 09:37:51 +01:00 committed by GitHub
parent b7f681a068
commit 4ecbbab7da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 190 additions and 112 deletions

View file

@ -1,10 +1,29 @@
import React from "react";
import ReactDOM from "react-dom";
import * as Sentry from "@sentry/browser";
import { TopErrorBoundary } from "./components/TopErrorBoundary";
import { IsMobileProvider } from "./is-mobile";
import { App } from "./components/App";
import "./styles.scss";
const SentyEnvHostnameMap: { [key: string]: string } = {
"excalidraw.com": "production",
"now.sh": "staging",
};
const onlineEnv = Object.keys(SentyEnvHostnameMap).find(
(item) => window.location.hostname.indexOf(item) >= 0,
);
Sentry.init({
// Disable Sentry locally to avoid noise
dsn: onlineEnv
? "https://7bfc596a5bf945eda6b660d3015a5460@sentry.io/5179260"
: undefined,
environment: onlineEnv ? SentyEnvHostnameMap[onlineEnv] : undefined,
release: process.env.REACT_APP_GIT_SHA,
});
// Block pinch-zooming on iOS outside of the content area
document.addEventListener(
"touchmove",