Skip to content

Commit

Permalink
Merge pull request #1546 from Thorium-Sim/sentry
Browse files Browse the repository at this point in the history
Sentry
  • Loading branch information
alexanderson1993 committed Nov 15, 2018
2 parents 0061bb4 + 96fb5b8 commit 761ad16
Show file tree
Hide file tree
Showing 13 changed files with 283 additions and 16 deletions.
54 changes: 53 additions & 1 deletion client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thorium-client",
"version": "1.0.27",
"version": "1.0.28",
"description": "Starship Simulator Controls built with React",
"repository": {
"type": "git",
Expand Down Expand Up @@ -29,6 +29,7 @@
"clean-build": "rm -rf build"
},
"dependencies": {
"@sentry/browser": "^4.3.0",
"@tweenjs/tween.js": "^17.2.0",
"apollo-cache-inmemory": "^1.2.10",
"apollo-client": "^2.4.2",
Expand Down
16 changes: 13 additions & 3 deletions client/src/components/core/layouts/coreError.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import React, { Component } from "react";

import * as Sentry from "@sentry/browser";
import { Button } from "reactstrap";
class CoreError extends Component {
state = { error: false };
componentDidCatch() {
componentDidCatch(error, errorInfo) {
this.setState({ error: true });
Sentry.withScope(scope => {
Object.keys(errorInfo).forEach(key => {
scope.setExtra(key, errorInfo[key]);
});
Sentry.captureException(error);
});
}
render() {
if (this.state.error)
return (
<div>
An error has occured. Please refer to the developer console for error
details.
details.{" "}
<Button size="sm" onClick={() => Sentry.showReportDialog()} href="#">
Report feedback
</Button>
</div>
);
return this.props.children;
Expand Down
15 changes: 13 additions & 2 deletions client/src/helpers/errorBoundary.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { Component } from "react";
import { Container, Button } from "reactstrap";
import * as Sentry from "@sentry/browser";

export default class ErrorBoundary extends Component {
constructor(props) {
super(props);
Expand All @@ -13,6 +15,12 @@ export default class ErrorBoundary extends Component {
errorInfo: errorInfo
});
// You can also log error messages to an error reporting service here
Sentry.withScope(scope => {
Object.keys(errorInfo).forEach(key => {
scope.setExtra(key, errorInfo[key]);
});
Sentry.captureException(error);
});
}
refresh() {
localStorage.clear();
Expand All @@ -26,8 +34,11 @@ export default class ErrorBoundary extends Component {
<div className="error-boundary">
<Container>
<h2>
Error in Thorium client. Please{" "}
<Button onClick={this.refresh}>Refresh</Button>
Error in Thorium client.{" "}
<Button onClick={() => Sentry.showReportDialog()}>
Report feedback
</Button>{" "}
or <Button onClick={this.refresh}>Refresh</Button>
</h2>
<h3>
If you know what you are looking for, you can check out what went
Expand Down
5 changes: 5 additions & 0 deletions client/src/helpers/sentry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as Sentry from "@sentry/browser";

Sentry.init({
dsn: "https://c71a50635f9b42f4a70880cce6a7ff0e@sentry.io/1323903"
});
1 change: 1 addition & 0 deletions client/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { render } from "react-dom";
import "./helpers/sentry";
import App from "./App";
import "bootstrap/scss/bootstrap.scss";

Expand Down
11 changes: 8 additions & 3 deletions client/src/releaseNotes.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"1.0.29": {
"features": [
"Add the error tracking framework Sentry to have a better idea of when and how errors happen."
]
},
"1.0.27": {
"features":[
"Adds the ability to define the direction the shuttles need to go along with more straightforward directions on the shuttlebay crew screen."
],
"features": [
"Adds the ability to define the direction the shuttles need to go along with more straightforward directions on the shuttlebay crew screen."
],
"fixes": [
"Improves how editing timeline steps during a mission works. Adds a 'Restore' button to bring back the timeline item's configuration.",
"Timeline step editing now does not override steps that were not edited.",
Expand Down
92 changes: 89 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thorium",
"version": "1.0.27",
"version": "1.0.28",
"description": "Starship Simulator Controls",
"private": true,
"repository": {
Expand Down Expand Up @@ -55,6 +55,7 @@
"plop": "plop"
},
"dependencies": {
"@sentry/node": "^4.3.0",
"apollo-cache-hermes": "^0.6.3",
"appdirectory": "^0.1.0",
"bonjour": "^3.5.0",
Expand Down
Loading

0 comments on commit 761ad16

Please sign in to comment.