From 16879ab3904ff0bfd977ba34c65181578110bb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 4 Sep 2026 16:09:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95=20Markdown=20=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E5=A4=B1=E8=B4=A5=E4=BF=A1=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在错误边界捕获时记录脱敏错误类型 保留消息正文回退且不输出敏感内容 --- .../src/components/ChatMarkdownMessage/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/ai-game-creator-shell/src/components/ChatMarkdownMessage/index.tsx b/apps/ai-game-creator-shell/src/components/ChatMarkdownMessage/index.tsx index ab7df6394..057860d7c 100644 --- a/apps/ai-game-creator-shell/src/components/ChatMarkdownMessage/index.tsx +++ b/apps/ai-game-creator-shell/src/components/ChatMarkdownMessage/index.tsx @@ -28,8 +28,14 @@ export class MarkdownErrorBoundary extends Component< return { hasError: true }; } - componentDidCatch(_error: unknown, _errorInfo: ErrorInfo) { + componentDidCatch(error: unknown, errorInfo: ErrorInfo) { // Keep the original message visible without logging its potentially sensitive content. + const errorName = + error instanceof Error && error.name ? error.name : 'UnknownError'; + console.error('[chat-markdown] render failed', { + errorName, + hasComponentStack: Boolean(errorInfo.componentStack?.trim()), + }); } componentDidUpdate(prevProps: MarkdownErrorBoundaryProps) {