client: add Raygun exception tracking

This commit is contained in:
Marks Polakovs 2020-04-10 12:57:03 +02:00
parent daeacd238f
commit e0039e653e
4 changed files with 30 additions and 6 deletions

View file

@ -12,6 +12,7 @@
"@types/lodash": "^4.14.149", "@types/lodash": "^4.14.149",
"@types/node": "^13.11.0", "@types/node": "^13.11.0",
"@types/qs": "^6.9.0", "@types/qs": "^6.9.0",
"@types/raygun4js": "^2.13.2",
"@types/react": "16.9.11", "@types/react": "16.9.11",
"@types/react-beautiful-dnd": "^11.0.3", "@types/react-beautiful-dnd": "^11.0.3",
"@types/react-beforeunload": "^2.1.0", "@types/react-beforeunload": "^2.1.0",
@ -64,6 +65,7 @@
"postcss-preset-env": "6.7.0", "postcss-preset-env": "6.7.0",
"postcss-safe-parser": "4.0.1", "postcss-safe-parser": "4.0.1",
"qs": "^6.9.1", "qs": "^6.9.1",
"raygun4js": "^2.18.3",
"react": "^16.13.1", "react": "^16.13.1",
"react-app-polyfill": "^1.0.4", "react-app-polyfill": "^1.0.4",
"react-beautiful-dnd": "^12.1.1", "react-beautiful-dnd": "^12.1.1",

View file

@ -4,9 +4,14 @@ import "./index.css";
import App from "./App"; import App from "./App";
import * as serviceWorker from "./serviceWorkerLoader"; import * as serviceWorker from "./serviceWorkerLoader";
import raygun from "raygun4js";
import store from "./store"; import store from "./store";
import { Provider } from "react-redux"; import { Provider } from "react-redux";
raygun("apiKey", "mtj24r3YzPoYyCG8cVArA");
raygun("enableCrashReporting", true);
function render() { function render() {
ReactDOM.render( ReactDOM.render(
<Provider store={store}> <Provider store={store}>

View file

@ -6,6 +6,8 @@ import { AppThunk } from "../store";
import { User, getCurrentApiUser, Timeslot, getCurrentApiTimeslot, doesCurrentUserHavePermission } from "../api"; import { User, getCurrentApiUser, Timeslot, getCurrentApiTimeslot, doesCurrentUserHavePermission } from "../api";
import { timestampToDateTime } from "../lib/utils"; import { timestampToDateTime } from "../lib/utils";
import raygun from "raygun4js";
const BROADCAST_PERMISSION_ID = 340; const BROADCAST_PERMISSION_ID = 340;
interface sessionState { interface sessionState {
@ -78,6 +80,11 @@ export const getUser = (): AppThunk => async dispatch => {
dispatch(sessionState.actions.getUserStarting()); dispatch(sessionState.actions.getUserStarting());
try { try {
const [user, canBroadcast] = await Promise.all([ getCurrentApiUser(), doesCurrentUserHavePermission(BROADCAST_PERMISSION_ID) ]); const [user, canBroadcast] = await Promise.all([ getCurrentApiUser(), doesCurrentUserHavePermission(BROADCAST_PERMISSION_ID) ]);
raygun("setUser", {
identifier: user.memberid.toString(10),
firstName: user.fname,
fullName: user.fname + " " + user.sname
});
dispatch(sessionState.actions.setCurrentUser({user, canBroadcast})); dispatch(sessionState.actions.setCurrentUser({user, canBroadcast}));
} catch (e) { } catch (e) {
console.log("failed to get user. " + e.toString()) console.log("failed to get user. " + e.toString())

View file

@ -1469,6 +1469,11 @@
resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.1.tgz#937fab3194766256ee09fcd40b781740758617e7" resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.1.tgz#937fab3194766256ee09fcd40b781740758617e7"
integrity sha512-lhbQXx9HKZAPgBkISrBcmAcMpZsmpe/Cd/hY7LGZS5OfkySUBItnPZHgQPssWYUET8elF+yCFBbP1Q0RZPTdaw== integrity sha512-lhbQXx9HKZAPgBkISrBcmAcMpZsmpe/Cd/hY7LGZS5OfkySUBItnPZHgQPssWYUET8elF+yCFBbP1Q0RZPTdaw==
"@types/raygun4js@^2.13.2":
version "2.13.2"
resolved "https://registry.yarnpkg.com/@types/raygun4js/-/raygun4js-2.13.2.tgz#5ca323687c6a2e7e0f744d176e81ff3c3b35f28f"
integrity sha512-lcEfBC5dIoSuRT5A9JaUXD5HetgXYnFJaj3+5e9FfEer1Z2Hr7UzSMCbRbF91x86IW1IhbTpH7CpZx1LvoNOIQ==
"@types/react-beautiful-dnd@^11.0.3": "@types/react-beautiful-dnd@^11.0.3":
version "11.0.5" version "11.0.5"
resolved "https://registry.yarnpkg.com/@types/react-beautiful-dnd/-/react-beautiful-dnd-11.0.5.tgz#2f5bc733dd46da28312c8ee0c126ab7202b90247" resolved "https://registry.yarnpkg.com/@types/react-beautiful-dnd/-/react-beautiful-dnd-11.0.5.tgz#2f5bc733dd46da28312c8ee0c126ab7202b90247"
@ -8722,6 +8727,11 @@ raw-body@2.4.0:
iconv-lite "0.4.24" iconv-lite "0.4.24"
unpipe "1.0.0" unpipe "1.0.0"
raygun4js@^2.18.3:
version "2.18.3"
resolved "https://registry.yarnpkg.com/raygun4js/-/raygun4js-2.18.3.tgz#204a403dcc95d6e449d58952d0a6ade0bde2ca98"
integrity sha512-JVVAIYOqUcU9zqMhUJ34Wuh2U45ZY8E/S0v6FVieOku0boZYRMh+8jh7g/OQ8JqAXDjjMpF+GJCcdeVAXHIUeg==
react-app-polyfill@^1.0.4: react-app-polyfill@^1.0.4:
version "1.0.6" version "1.0.6"
resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz#890f8d7f2842ce6073f030b117de9130a5f385f0" resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz#890f8d7f2842ce6073f030b117de9130a5f385f0"