PrettyError: redesign to make more reusable.
parent
8fe360751e
commit
95944d87b5
|
@ -59,7 +59,10 @@ class ErrorBoundary extends React.Component<PropsType> {
|
|||
|
||||
if (error) {
|
||||
return (
|
||||
<PrettyError error={this.state.error} />
|
||||
<div>
|
||||
<h2>Something went wrong!</h2>
|
||||
<PrettyError error={this.state.error} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return this.props.children;
|
||||
|
|
|
@ -2,12 +2,10 @@ import * as React from 'react';
|
|||
|
||||
export const PrettyError = React.memo((props: any) => (
|
||||
<div>
|
||||
<h2>Something went wrong!</h2>
|
||||
<pre>
|
||||
<pre style={{ fontWeight: 'bold' }}>
|
||||
{props.error.message}
|
||||
</pre>
|
||||
|
||||
<h3>Stack trace:</h3>
|
||||
<pre>
|
||||
{props.error.stack}
|
||||
</pre>
|
||||
|
|
Loading…
Reference in New Issue