diff --git a/plugin/preload.js b/plugin/preload.js index 77b7947..53460f6 100644 --- a/plugin/preload.js +++ b/plugin/preload.js @@ -151,6 +151,7 @@ let getSandboxFuns = () => { // 简化报错信息 let liteErr = (e) => { if (!e) return; + if (typeof e === "string") return e; return e.error ? e.error.stack.replace(/([ ] +at.+)|(.+\.js:\d+)/g, "").trim() : e.message; diff --git a/src/components/CommandRunResult.vue b/src/components/CommandRunResult.vue index 2cc4199..100fc09 100644 --- a/src/components/CommandRunResult.vue +++ b/src/components/CommandRunResult.vue @@ -296,7 +296,7 @@ export default { ? alert(stderr) : this.showRunResult(stderr, false); } - !options.action(stdout.toString()) || this.showRunResult(stdout, true); + !options.action(stdout?.toString()) || this.showRunResult(stdout, true); }, // 显示运行结果 async showRunResult(content, isSuccess) {