l'error handleing marche peut etre, est-ce du au mode developer env ??? 🔥
continuous-integration/drone/push Build is failing Details

pull/91/head
Pierre Ferreira 7 months ago
parent e45fe3e7ca
commit 5dbc0653d6

@ -73,7 +73,7 @@ function App() {
// </header>
// </div>
<ErrorBoundary>
<ErrorBoundary fallback={(error, errorInfo) => <ErrorPage />}>
<AuthProvider>
<GameProvider>
{/*@ts-ignore*/}

@ -1,7 +1,9 @@
import React, { Component, ErrorInfo, ReactNode } from 'react';
import ErrorPage from './ErrorPage';
interface ErrorBoundaryProps {
fallback: (error: Error, errorInfo: ErrorInfo) => ReactNode;
children: ReactNode;
}
@ -22,15 +24,12 @@ class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
}
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
// Vous pouvez également enregistrer l'erreur dans un service de journalisation
console.error('Error caught by ErrorBoundary:', error, errorInfo);
}
render(): ReactNode {
if (this.state.hasError) {
// Vous pouvez personnaliser cette partie avec une page d'erreur
//return <h1>Something went wrong. Please try again later.</h1>;
return <ErrorPage/>;
return this.props.fallback(new Error('Error caught by ErrorBoundary'), {});
}
return this.props.children;
@ -40,6 +39,7 @@ class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
export default ErrorBoundary;
// interface ErrorBoundaryProps {
// children: ReactNode;
// }

@ -11,5 +11,5 @@
border-radius: 10px;
margin: 15px;
padding: 10px;
box-shadow: 5px 5px 5px #900C3F;
box-shadow: 5px 5px 5px #900C3F;
}

@ -30,6 +30,13 @@ import { useNavigate } from 'react-router-dom';
//@ts-ignore
const Profile = () => {
useEffect(() => {
// Déclenchez l'erreur à l'intérieur de useEffect pour éviter des problèmes à la compilation
//@ts-ignore
console.log(undefinedVariable);
}, []); // Déclenchez cette fonction une seule fois après le rendu initial
const navigate = useNavigate();
//let player;
const {user, logout} = useAuth()

Loading…
Cancel
Save