|
|
|
@ -1,10 +1,14 @@
|
|
|
|
import { Component } from 'react';
|
|
|
|
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
|
|
import { Trans } from 'react-i18next';
|
|
|
|
import { Trans } from 'react-i18next';
|
|
|
|
|
|
|
|
|
|
|
|
import { openSendReportDialog } from './reporting';
|
|
|
|
import { openSendReportDialog } from './reporting';
|
|
|
|
|
|
|
|
|
|
|
|
class ErrorBoundary extends Component {
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
class ErrorBoundary extends Component<{ children: ReactNode }> {
|
|
|
|
|
|
|
|
// eslint-disable-next-line react/state-in-constructor
|
|
|
|
|
|
|
|
override state: { error: { message: string } | undefined };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(props: { children: ReactNode }) {
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
|
this.state = { error: undefined };
|
|
|
|
this.state = { error: undefined };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -13,11 +17,11 @@ class ErrorBoundary extends Component {
|
|
|
|
return { error };
|
|
|
|
return { error };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidCatch(error, errorInfo) {
|
|
|
|
override componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
|
|
|
console.error('componentDidCatch', error, errorInfo);
|
|
|
|
console.error('componentDidCatch', error, errorInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
override render() {
|
|
|
|
const { error } = this.state;
|
|
|
|
const { error } = this.state;
|
|
|
|
if (error) {
|
|
|
|
if (error) {
|
|
|
|
return (
|
|
|
|
return (
|