HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/wp-recipe-maker/assets/js/shared/ErrorBoundary.js
import React, { Component, Fragment } from 'react';

import '../../css/admin/shared/error-boundary.scss';

export default class ErrorBoundary extends Component {

    constructor(props) {
        super(props);
        
        this.state = {
            hasError: false,
            error: false,
            info: false,
        }
    }

    componentDidCatch(error, info) {
        this.setState({
            hasError: true,
            error,
            info,
        });
    }

    render() {
        return (
            <Fragment>
                {
                    this.state.hasError
                    ?
                    <div className="wprm-error-boundary">
                        <p>
                            <strong>Something went wrong</strong><br/>
                            Please contact <a href="mailto:support@bootstrapped.ventures">support@bootstrapped.ventures</a> and send along the following information:</p>
                        <pre>
                            { this.props.module ? `Module: ${ this.props.module }\n` : null }
                            { this.state.error ? `Error: ${ this.state.error.toString() }\n` : null }
                            { this.state.info ? `Stack: ${ this.state.info.componentStack }` : null }
                        </pre>
                    </div>
                    :
                    this.props.children
                }
            </Fragment>
        );
    }
}