PrettyError: redesign to make more reusable.

master
Tom Hacohen 5 years ago
parent 8fe360751e
commit 95944d87b5

@ -59,7 +59,10 @@ class ErrorBoundary extends React.Component<PropsType> {
if (error) { if (error) {
return ( return (
<div>
<h2>Something went wrong!</h2>
<PrettyError error={this.state.error} /> <PrettyError error={this.state.error} />
</div>
); );
} }
return this.props.children; return this.props.children;

@ -2,12 +2,10 @@ import * as React from 'react';
export const PrettyError = React.memo((props: any) => ( export const PrettyError = React.memo((props: any) => (
<div> <div>
<h2>Something went wrong!</h2> <pre style={{ fontWeight: 'bold' }}>
<pre>
{props.error.message} {props.error.message}
</pre> </pre>
<h3>Stack trace:</h3>
<pre> <pre>
{props.error.stack} {props.error.stack}
</pre> </pre>

Loading…
Cancel
Save