UNPKG

@jbrowse/core

Version:

JBrowse 2 core libraries used by plugins

17 lines (16 loc) 551 B
import { jsx as _jsx } from "react/jsx-runtime"; import { Component } from 'react'; class ErrorBoundary extends Component { constructor(props) { super(props); this.state = { error: undefined }; } componentDidCatch(error, errorInfo) { console.error('ErrorBoundary caught an error:', error, errorInfo); this.setState({ error }); } render() { return this.state.error ? (_jsx(this.props.FallbackComponent, { error: this.state.error })) : (this.props.children); } } export { ErrorBoundary };