diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx index e13ebe5..a37ca93 100644 --- a/src/components/ErrorBoundary.tsx +++ b/src/components/ErrorBoundary.tsx @@ -1,5 +1,7 @@ import * as React from 'react'; +import PrettyError from '../widgets/PrettyError'; + class ErrorBoundary extends React.Component { state: { error?: Error; @@ -17,17 +19,7 @@ class ErrorBoundary extends React.Component { render() { if (this.state.error) { return ( -
-

Something went wrong!

-
-            {this.state.error.message}
-          
- -

Stack trace:

-
-            {this.state.error.stack}
-          
-
+ ); } return this.props.children; diff --git a/src/widgets/PrettyError.tsx b/src/widgets/PrettyError.tsx new file mode 100644 index 0000000..c62ccc0 --- /dev/null +++ b/src/widgets/PrettyError.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; +import { pure } from 'recompose'; + +export const PrettyError = pure((props: any) => ( +
+

Something went wrong!

+
+      {props.error.message}
+    
+ +

Stack trace:

+
+      {props.error.stack}
+    
+
+)); + +export default PrettyError;