mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
feat: 更新 sentry 错误上报
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import * as React from 'react'
|
||||
import { captureException } from 'src/utils/sentry.js'
|
||||
|
||||
interface Props {
|
||||
children: React.ReactNode
|
||||
/** Optional label for identifying which component boundary caught the error */
|
||||
name?: string
|
||||
}
|
||||
|
||||
interface State {
|
||||
@@ -18,6 +21,13 @@ export class SentryErrorBoundary extends React.Component<Props, State> {
|
||||
return { hasError: true }
|
||||
}
|
||||
|
||||
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
|
||||
captureException(error, {
|
||||
componentBoundary: this.props.name || 'SentryErrorBoundary',
|
||||
componentStack: errorInfo.componentStack,
|
||||
})
|
||||
}
|
||||
|
||||
render(): React.ReactNode {
|
||||
if (this.state.hasError) {
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user