import { Component } from 'react'
export default class ErrorBoundary extends Component {
constructor(props) {
super(props)
this.state = { error: null, info: null }
}
componentDidCatch(error, info) {
this.setState({ error, info })
console.error('[GLB Studio Error]', error, info)
}
render() {
if (this.state.error) {
return (
⚠️
GLB Studio crashed
{String(this.state.error)}
)
}
return this.props.children
}
}