claude-code/components/SentryErrorBoundary.ts
2026-04-01 14:57:08 +03:00

28 lines
487 B
TypeScript

import * as React from 'react'
interface Props {
children: React.ReactNode
}
interface State {
hasError: boolean
}
export class SentryErrorBoundary extends React.Component<Props, State> {
constructor(props: Props) {
super(props)
this.state = { hasError: false }
}
static getDerivedStateFromError(): State {
return { hasError: true }
}
render(): React.ReactNode {
if (this.state.hasError) {
return null
}
return this.props.children
}
}