import PropTypes from 'prop-types';
import React from 'react';
+import ErrorMessage from './ErrorMessage';
+
class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
const { children } = this.props;
const { error } = this.state;
if (error) {
- return <p>error</p>;
+ return <ErrorMessage error={error} />;
}
return children;
}
<p className="mb-0">{i18n.t(`error.${error.response.status}.description`)}</p>
</Alert>;
}
+ if (error.message) {
+ return <Alert variant="danger">
+ <Alert.Heading>Error</Alert.Heading>
+ <p className="mb-0">{error.message}</p>
+ </Alert>;
+ }
return <div className="error">Error</div>;
};