fix: show friendly error message in production

This commit is contained in:
小鱼开发
2026-05-18 22:01:41 +08:00
parent 721d690370
commit a9fb0838cf
@@ -49,7 +49,11 @@ export default function ScriptCreation() {
.catch((err: Error) => {
console.error('[分类加载失败]', err);
if (!cached) {
toast.error(`加载分类列表失败: ${err.message}`);
// 生产环境显示友好固定文案,开发环境显示详细错误
const msg = import.meta.env.PROD
? '加载分类列表失败,请检查网络连接'
: `加载分类列表失败: ${err.message}`;
toast.error(msg);
}
});
}, []);