Skip to content

Commit 8a9b4a7

Browse files
committed
Replace Sentry user feedback with GitHub issue reporting
The previous system didn't work very well, and Sentry does some weird things with user feedback anyway. We could try to improve it, or we could just drop that entirely and keep it simple instead, so let's do the latter.
1 parent 56a7d9d commit 8a9b4a7

File tree

3 files changed

+38
-45
lines changed

3 files changed

+38
-45
lines changed

src/components/error-boundary.tsx

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import { observer } from 'mobx-react';
33
import { observable, action } from 'mobx';
44

55
import { styled } from '../styles';
6-
import { Sentry, isSentryInitialized } from '../errors';
6+
import { Sentry } from '../errors';
7+
import { isErrorLike } from '../util/error';
78
import { trackEvent } from '../metrics';
89

10+
import { Button, ButtonLink } from './common/inputs';
11+
912
const ErrorOverlay = styled((props: {
1013
className?: string,
1114
children: React.ReactNode
@@ -25,43 +28,40 @@ const ErrorOverlay = styled((props: {
2528
align-items: center;
2629
justify-content: center;
2730
31+
overflow-y: auto;
32+
2833
color: ${p => p.theme.mainColor};
2934
3035
h1 {
31-
font-size: 300px;
36+
font-size: ${p => p.theme.screamingHeadingSize};
3237
font-weight: bold;
33-
line-height: 230px;
3438
margin-bottom: 50px;
3539
}
3640
37-
p {
38-
font-size: 50px;
41+
h2 {
42+
font-size: ${p => p.theme.loudHeadingSize};
3943
margin-bottom: 50px;
4044
}
4145
42-
button {
46+
button, a {
4347
display: block;
44-
margin: 0 auto 40px;
45-
46-
color: ${p => p.theme.mainColor};
47-
background-color: ${p => p.theme.mainBackground};
48-
box-shadow: 0 2px 10px 0 rgba(0,0,0,${p => p.theme.boxShadowAlpha});
49-
border-radius: 4px;
50-
border: none;
48+
margin: 40px 40px 0;
5149
5250
padding: 20px;
5351
54-
font-size: 50px;
52+
font-size: ${p => p.theme.loudHeadingSize};
5553
font-weight: bolder;
54+
}
55+
`;
5656

57-
&:not(:disabled) {
58-
cursor: pointer;
57+
const ButtonContainer = styled.div`
58+
display: flex;
59+
flex-wrap: wrap;
60+
`;
5961

60-
&:hover {
61-
color: ${p => p.theme.popColor};
62-
}
63-
}
64-
}
62+
const ErrorOutput = styled.code`
63+
font-family: ${p => p.theme.monoFontFamily};
64+
white-space: preserve;
6565
`;
6666

6767
@observer
@@ -70,9 +70,6 @@ export class ErrorBoundary extends React.Component {
7070
@observable
7171
private error: Error | undefined;
7272

73-
@observable
74-
private feedbackSent: boolean = false;
75-
7673
@action
7774
componentDidCatch(error: Error, errorInfo: any) {
7875
this.error = error;
@@ -96,26 +93,25 @@ export class ErrorBoundary extends React.Component {
9693
<h1>
9794
Oh no!
9895
</h1>
99-
<p>
96+
<h2>
10097
Sorry, it's all gone wrong.
101-
</p>
102-
<div>
103-
{ isSentryInitialized() &&
104-
<button disabled={this.feedbackSent} onClick={this.sendFeedback}>
105-
Tell us what happened
106-
</button>
107-
}
108-
<button onClick={() => window.location.reload()}>
98+
</h2>
99+
{ isErrorLike(this.error) && <ErrorOutput>
100+
{ this.error.stack ?? this.error.message }
101+
</ErrorOutput> }
102+
<ButtonContainer>
103+
<ButtonLink href={
104+
`https://github.com/httptoolkit/httptoolkit/issues/new?template=bug.yml&title=[UI Crash]%3A+${
105+
this.error.message || ''
106+
}`
107+
}>
108+
Tell us what happened
109+
</ButtonLink>
110+
<Button onClick={() => window.location.reload()}>
109111
Reload HTTP Toolkit
110-
</button>
111-
</div>
112+
</Button>
113+
</ButtonContainer>
112114
</ErrorOverlay>
113115
) : this.props.children;
114116
}
115-
116-
@action.bound
117-
sendFeedback() {
118-
Sentry.showReportDialog();
119-
this.feedbackSent = true;
120-
}
121117
}

src/errors.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ import { ApiError } from './services/server-api-types';
66

77
let sentryInitialized = false;
88

9-
export function isSentryInitialized() {
10-
return sentryInitialized;
11-
}
12-
139
export { Sentry };
1410

1511
export function initSentry(dsn: string | undefined) {

src/styles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const fontSizes = {
1212
headingSize: '20px',
1313
largeHeadingSize: '24px',
1414
loudHeadingSize: '38px',
15+
screamingHeadingSize: '80px'
1516
};
1617
import "react-contexify/dist/ReactContexify.css";
1718

0 commit comments

Comments
 (0)