From 2ce9d97be3e92fd85f628d3eba3a399bf1470a78 Mon Sep 17 00:00:00 2001
From: Joe Banks <joseph@josephbanks.me>
Date: Tue, 6 Oct 2020 19:38:07 +0100
Subject: Enable Sentry in production

---
 src/index.tsx | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'src/index.tsx')

diff --git a/src/index.tsx b/src/index.tsx
index 634fd81..0198756 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -3,8 +3,21 @@ import ReactDOM from 'react-dom';
 import App from './App';
 import * as serviceWorker from './serviceWorker';
 
+import * as Sentry from "@sentry/react";
+import { Integrations } from "@sentry/tracing";
+
 import colors from "./colors";
 
+if (process.env.NODE_ENV === "production") {
+  Sentry.init({
+    dsn: process.env.REACT_APP_SENTRY_DSN,
+    integrations: [
+      new Integrations.BrowserTracing(),
+    ],
+    tracesSampleRate: 0.25,
+  });
+}
+
 console.log("%c  Python Discord Forms  ", `font-size: 6em; font-family: "Hind", "Arial"; font-weight: 900; background-color: ${colors.blurple}; border-radius: 10px;`)
 console.log("%cWelcome to Python Discord Forms", `font-size: 3em; font-family: "Hind", "Arial";`)
 
-- 
cgit v1.2.3


From 896230b7f993d61ee7c6b43fe386c048a6b1fca9 Mon Sep 17 00:00:00 2001
From: Joe Banks <joseph@josephbanks.me>
Date: Thu, 8 Oct 2020 23:32:02 +0100
Subject: Render the Sentry error boundary

---
 src/index.tsx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'src/index.tsx')

diff --git a/src/index.tsx b/src/index.tsx
index 0198756..50385ea 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -31,7 +31,15 @@ console.log("%cCome join us on Discord! https://discord.gg/python", `font-size:
 
 ReactDOM.render(
   <React.StrictMode>
-    <App />
+    <Sentry.ErrorBoundary
+      fallback={<p>An error has occurred with Python Discord Forms. Please let us know in the Discord server at <a href="https://discord.gg/python">discord.gg/python</a></p>}
+      showDialog={true}
+      dialogOptions={{
+        title: "You've found a bug in PyDis forms!"
+      }}
+    >
+      <App />
+    </Sentry.ErrorBoundary>
   </React.StrictMode>,
   document.getElementById('root')
 );
-- 
cgit v1.2.3


From eafa1a30dc1e354967ee621d92634557cd910f17 Mon Sep 17 00:00:00 2001
From: Joe Banks <joseph@josephbanks.me>
Date: Thu, 8 Oct 2020 23:32:57 +0100
Subject: Report release information to Sentry

---
 src/index.tsx | 1 +
 1 file changed, 1 insertion(+)

(limited to 'src/index.tsx')

diff --git a/src/index.tsx b/src/index.tsx
index 50385ea..783d34f 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -15,6 +15,7 @@ if (process.env.NODE_ENV === "production") {
       new Integrations.BrowserTracing(),
     ],
     tracesSampleRate: 0.25,
+    release: `forms-frontend@${process.env.REACT_APP_SHA}`
   });
 }
 
-- 
cgit v1.2.3

