mirror of https://github.com/trezor/trezor-wallet
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
512 B
22 lines
512 B
import React, { Component } from 'react';
|
|
import RedBox from 'redbox-react';
|
|
|
|
class ErrorBoundary extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = { hasError: false, error: false };
|
|
}
|
|
|
|
componentDidCatch(error, info) {
|
|
this.setState({ hasError: true, error });
|
|
}
|
|
|
|
render() {
|
|
if (this.state.hasError) {
|
|
return <RedBox error={this.state.error} />;
|
|
}
|
|
return this.props.children;
|
|
}
|
|
}
|
|
|
|
export default ErrorBoundary; |