File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/sentry/static/sentry/app/utils Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,6 @@ import RouteError from 'app/views/routeError';
4
4
export default function errorHandler ( Component ) {
5
5
class ErrorHandler extends React . Component {
6
6
static getDerivedStateFromError ( error ) {
7
- setTimeout ( ( ) => {
8
- throw error ;
9
- } ) ;
10
-
11
7
// Update state so the next render will show the fallback UI.
12
8
return {
13
9
hasError : true ,
@@ -16,10 +12,20 @@ export default function errorHandler(Component) {
16
12
}
17
13
18
14
state = {
15
+ // we are explicit if an error has been thrown since errors thrown are not guaranteed
16
+ // to be truthy (e.g. throw null).
19
17
hasError : false ,
20
18
error : null ,
21
19
} ;
22
20
21
+ componentDidCatch ( error , info ) {
22
+ // eslint-disable-next-line no-console
23
+ console . error (
24
+ 'Component stack trace caught in <ErrorHandler />:' ,
25
+ info . componentStack
26
+ ) ;
27
+ }
28
+
23
29
render ( ) {
24
30
if ( this . state . hasError ) {
25
31
return < RouteError error = { this . state . error } /> ;
You can’t perform that action at this time.
0 commit comments