prompt batch error

This commit is contained in:
codetypes committed 2024-07-16 17:23:10 +08:00
1 parent 9264d0d28a
commit 5c57212a90
3 files changed
+11

No files matched your search

+2
View File
@@ -3,6 +3,8 @@
"actuaSize": "Actual Size", "actuaSize": "Actual Size",
"build": "Build", "build": "Build",
"batch": "Batch Script", "batch": "Batch Script",
"batchCompleted": "Batch completed",
"batchFailed": "Batch failed, more information can be found in the console.",
"buildCompleted": "Build completed", "buildCompleted": "Build completed",
"buildFailed": "Build failed, more information can be found in the console.", "buildFailed": "Build failed, more information can be found in the console.",
"cancel": "Cancel", "cancel": "Cancel",
+2
View File
@@ -3,6 +3,8 @@
"actualSize": "实际大小", "actualSize": "实际大小",
"build": "构建", "build": "构建",
"batch": "批处理脚本", "batch": "批处理脚本",
"batchCompleted": "批处理完成",
"batchFailed": "批处理出现错误,详情请查看控制台!",
"buildCompleted": "构建完成", "buildCompleted": "构建完成",
"buildFailed": "构建出现错误,详情请查看控制台!", "buildFailed": "构建出现错误,详情请查看控制台!",
"cancel": "取消", "cancel": "取消",
+7
View File
@@ -310,6 +310,7 @@ export const useWorkspace = create<WorkspaceStore>((set, get) => ({
filters: [{ name: "Javascript", extensions: ["js"] }], filters: [{ name: "Javascript", extensions: ["js"] }],
})?.[0]; })?.[0];
if (scriptPath) { if (scriptPath) {
let hasError = false;
try { try {
console.log("run script", scriptPath); console.log("run script", scriptPath);
const str = fs.readFileSync(scriptPath, "utf8"); const str = fs.readFileSync(scriptPath, "utf8");
@@ -332,8 +333,14 @@ export const useWorkspace = create<WorkspaceStore>((set, get) => ({
} }
}); });
} catch (error) { } catch (error) {
hasError = true;
console.error(error); console.error(error);
} }
if (hasError) {
message.error(i18n.t("batchFailed"));
} else {
message.success(i18n.t("batchCompleted"));
}
} }
}, },