-
Oops! Something went wrong.
-
Were sorry for the inconvenience. Here are a few options:
-
-
-
-
- {/* Additional navigation options can be added here */}
-
- Details
- {this.state.error && this.state.error?.toString()}
-
- {this.state.errorInfo?.componentStack}
-
-
- );
- }
-
- return this.props.children;
- }
-}
-
-export default ErrorBoundary;
diff --git a/src/layout/REUSABLE_COMPONENTS/system-utils/ErrorFallback.jsx b/src/layout/REUSABLE_COMPONENTS/system-utils/ErrorFallback.jsx
index 36387aa..c6a6941 100644
--- a/src/layout/REUSABLE_COMPONENTS/system-utils/ErrorFallback.jsx
+++ b/src/layout/REUSABLE_COMPONENTS/system-utils/ErrorFallback.jsx
@@ -2,6 +2,8 @@ import React from 'react';
import { Typography, Button, Paper, Container, Box } from '@mui/material';
import RefreshIcon from '@mui/icons-material/Refresh';
import FileCopyIcon from '@mui/icons-material/FileCopy';
+import RCButton from '../RCBUTTON';
+import { useMode } from 'context';
class ErrorFallback extends React.Component {
constructor(props) {
@@ -9,16 +11,19 @@ class ErrorFallback extends React.Component {
this.state = { hasCopied: false };
}
- handleCopyErrorDetails = () => {
- navigator.clipboard.writeText(this.props.error.stack).then(
- () => this.setState({ hasCopied: true }),
- () => this.setState({ hasCopied: false })
- );
+ handleCopyErrorDetails = async () => {
+ try {
+ await navigator.clipboard.writeText(this.props.error.stack);
+ this.setState({ hasCopied: true });
+ setTimeout(() => this.setState({ hasCopied: false }), 2000); // Reset copy status after 2 seconds
+ } catch (error) {
+ console.error('Failed to copy error details:', error);
+ }
};
-
render() {
const { error, resetErrorBoundary } = this.props;
const { hasCopied } = this.state;
+ const { theme } = this.props;
return (