HEX
Server: LiteSpeed
System: Linux server902.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: deshuvsd (2181)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/deshuvsd/www/wp-content/plugins/surerank/src/apps/admin-components/error-boundary.js
import { Component } from '@wordpress/element';

class ErrorBoundary extends Component {
	constructor( props ) {
		super( props );
		this.state = { hasError: false, error: null };
	}

	static getDerivedStateFromError( error ) {
		return { hasError: true, error };
	}

	render() {
		if ( this.state.hasError ) {
			return (
				<div className="text-base font-medium text-text-error p-4 border border-solid border-border-error rounded-lg">
					Error: { this.state.error.message || 'Unknown error' }
				</div>
			);
		}

		return this.props.children;
	}
}

export default ErrorBoundary;