收敛资源预览与编辑错误正文

保留模型预览和资源编辑的安全错误详情
This commit is contained in:
kdletters
2026-10-05 16:55:52 +08:00
parent f2e1e3c0eb
commit 6312320cab
2 changed files with 6 additions and 13 deletions
@@ -1,6 +1,7 @@
import { ChevronLeft, LoaderCircle, Sparkles } from 'lucide-react';
import { type FormEvent, useState } from 'react';
import { visibleClientErrorMessage } from '../../services/errorReporting';
import {
type LocalProjectResourceEditKind,
resourceEditPromptMaxLength,
@@ -50,11 +51,7 @@ export function ResourceEditSurface({
try {
await onSubmit({ prompt: normalizedPrompt, assetName: normalizedName });
} catch (submitError) {
setError(
submitError instanceof Error
? submitError.message
: String(submitError),
);
setError(visibleClientErrorMessage(submitError, '资源编辑失败,请重试'));
setSubmitting(false);
}
}
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react';
import { visibleClientErrorMessage } from '../../services/errorReporting';
import {
addResourceModelLights,
disposeResourceModelObject,
@@ -61,9 +62,8 @@ export function ResourceModelViewer({
void (async () => {
try {
const THREE = await import('three');
const { OrbitControls } = await import(
'three/examples/jsm/controls/OrbitControls.js'
);
const { OrbitControls } =
await import('three/examples/jsm/controls/OrbitControls.js');
if (disposed) {
return;
}
@@ -154,11 +154,7 @@ export function ResourceModelViewer({
} catch (viewerError) {
if (!disposed) {
setStatus('failed');
setError(
viewerError instanceof Error
? viewerError.message
: String(viewerError),
);
setError(visibleClientErrorMessage(viewerError, '模型预览加载失败'));
}
}
})();