-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
953e2df
commit b8681c3
Showing
4 changed files
with
46 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,43 @@ | ||
import React from "react"; | ||
import { setTelegram } from "../constants"; | ||
|
||
import systemError from "../assets/img/systemError.png"; | ||
import { Tools } from "../components/Tools"; | ||
|
||
export class ErrorBoundary extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { error: null, errorInfo: null }; | ||
} | ||
constructor(props) { | ||
super(props); | ||
this.state = { error: null, errorInfo: null }; | ||
} | ||
|
||
componentDidCatch(error, errorInfo) { | ||
// Catch errors in any components below and re-render with error message | ||
this.setState({ | ||
error: error, | ||
errorInfo: errorInfo, | ||
}); | ||
// You can also log error messages to an error reporting service here | ||
} | ||
componentDidCatch(error, errorInfo) { | ||
// Catch errors in any components below and re-render with error message | ||
this.setState({ | ||
error: error, | ||
errorInfo: errorInfo, | ||
}); | ||
// You can also log error messages to an error reporting service here | ||
} | ||
|
||
render() { | ||
if (this.state.errorInfo) { | ||
setTelegram("errorHandler.js", this.state.errorInfo.componentStack); | ||
// Error path | ||
return ( | ||
<div className="cont"> | ||
<div className="ErrorContainer"> | ||
<div className="ErrorImage"> | ||
<img src={systemError} /> | ||
</div> | ||
<div className="ErrorText"> | ||
<h1>OUCH!</h1> | ||
<p>System Error.</p> | ||
</div> | ||
</div> | ||
<div className="ErrorToolsContainer"> | ||
<Tools /> | ||
</div> | ||
</div> | ||
); | ||
render() { | ||
if (this.state.errorInfo) { | ||
// Error path | ||
return ( | ||
<div className="cont"> | ||
<div className="ErrorContainer"> | ||
<div className="ErrorImage"> | ||
<img src={systemError} /> | ||
</div> | ||
<div className="ErrorText"> | ||
<h1>OUCH!</h1> | ||
<p>System Error.</p> | ||
</div> | ||
</div> | ||
<div className="ErrorToolsContainer"> | ||
<Tools /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
return this.props.children; | ||
} | ||
return this.props.children; | ||
} | ||
} |