PluginProbe
WP Ultimate Post Grid / 3.3.0
WP Ultimate Post Grid v3.3.0
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / assets / js / shared / ErrorBoundary.js

ErrorBoundary.js in WP Ultimate Post Grid 3.3.0, at assets/js/shared/ErrorBoundary.js

48 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React, { Component, Fragment } from 'react';
2
3 import '../../css/admin/shared/error-boundary.scss';
4
5 export default class ErrorBoundary extends Component {
6
7 constructor(props) {
8 super(props);
9
10 this.state = {
11 hasError: false,
12 error: false,
13 info: false,
14 }
15 }
16
17 componentDidCatch(error, info) {
18 this.setState({
19 hasError: true,
20 error,
21 info,
22 });
23 }
24
25 render() {
26 return (
27 <Fragment>
28 {
29 this.state.hasError
30 ?
31 <div className="wpupg-error-boundary">
32 <p>
33 <strong>Something went wrong</strong><br/>
34 Please contact <a href="mailto:support@bootstrapped.ventures">support@bootstrapped.ventures</a> and send along the following information:</p>
35 <pre>
36 { this.props.module ? `Module: ${ this.props.module }\n` : null }
37 { this.state.error ? `Error: ${ this.state.error.toString() }\n` : null }
38 { this.state.info ? `Stack: ${ this.state.info.componentStack }` : null }
39 </pre>
40 </div>
41 :
42 this.props.children
43 }
44 </Fragment>
45 );
46 }
47 }
48