general-assistant
Version:
General Assistant components
21 lines (20 loc) • 894 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Component } from 'react';
export default class ErrorBoundary extends Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
static getDerivedStateFromError(error) {
return { hasError: true };
}
componentDidCatch(error, errorInfo) {
}
render() {
const _t = typeof this.props?.t === 'function' ? this.props?.t : (_text) => _text;
if (this.state.hasError) {
return (_jsxs("div", { className: 'DS-GA-flex DS-GA-flex-col', children: [_jsx("p", { children: _t('comp') + _t('loadErr') }), _jsxs("p", { children: [_t('comp'), " type: ", this.props?.data?.type] }), _jsxs("p", { children: [_t('comp'), " content: ", JSON.stringify(this.props?.data?.content)] })] }));
}
return this.props.children;
}
}