Fix: terminal log err

This commit is contained in:
unitwk 2023-12-20 11:00:47 +08:00
parent 3b459f1d4d
commit d36361883f
2 changed files with 7 additions and 8 deletions

View File

@ -158,13 +158,12 @@ const initTerminal = async () => {
const dom = document.getElementById(terminalDomId.value);
if (dom) {
const term = initTerminalWindow(dom);
term.write(
(await getInstanceOutputLog()
.execute({
params: { uuid: instanceId || "", daemonId: daemonId || "" }
})
.then((res) => res.value)) || ""
);
try {
const { value } = await getInstanceOutputLog().execute({
params: { uuid: instanceId || "", daemonId: daemonId || "" }
});
if (value) term.write(value);
} catch (error) {}
return term;
}
throw new Error("init terminal failed");

View File

@ -147,7 +147,7 @@ const submit = async () => {
return message.success(t("TXT_CODE_d3de39b4"));
} catch (error: any) {
console.error(error);
return message.error(error.message);
return message.error(error.message ?? t("保存失败,请检查配置项"));
}
};