parent: - Add parent-student-attendance-detail component auth: - Add actions, data-access, schema, services, types onboarding: - Add parent-children-form and hooks directory files: - Add actions, schema, hooks directory notifications: - Add schema and schema test adaptive-practice: - Add answer-input, answer-result, practice-result-view, practice-starter-with-nav - Add question-card, question-content, lib and services directories ai: - Add context/create-ai-client-service, hooks/use-drag-position, hooks/use-position-persistence
32 lines
792 B
TypeScript
32 lines
792 B
TypeScript
"use client"
|
||
|
||
/**
|
||
* AI 专用 Error Boundary
|
||
*
|
||
* 薄包装:委托给共享 SectionErrorBoundary,使用 ai 命名空间。
|
||
* 保留同名导出以兼容现有 import。
|
||
*/
|
||
|
||
import type { ReactNode } from "react"
|
||
import { SectionErrorBoundary } from "@/shared/components/section-error-boundary"
|
||
|
||
type AiErrorBoundaryProps = {
|
||
children: ReactNode
|
||
/** 自定义 fallback 渲染 */
|
||
fallback?: (error: Error, reset: () => void) => ReactNode
|
||
/** 错误回调(用于埋点) */
|
||
onError?: (error: Error, info: unknown) => void
|
||
}
|
||
|
||
export function AiErrorBoundary({
|
||
children,
|
||
fallback,
|
||
onError,
|
||
}: AiErrorBoundaryProps): ReactNode {
|
||
return (
|
||
<SectionErrorBoundary namespace="ai" fallback={fallback} onError={onError}>
|
||
{children}
|
||
</SectionErrorBoundary>
|
||
)
|
||
}
|