From c66f7f9e1f6691c8b2b3d94287b43ceda5bb46ad Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 23 Nov 2024 13:05:20 +0800 Subject: [PATCH] Some minor changes to the error messages --- yazi-plugin/preset/plugins/archive.lua | 2 +- yazi-plugin/preset/plugins/extract.lua | 2 +- yazi-plugin/preset/plugins/file.lua | 2 +- yazi-plugin/preset/plugins/font.lua | 2 +- yazi-plugin/preset/plugins/fzf.lua | 2 +- yazi-plugin/preset/plugins/magick.lua | 2 +- yazi-plugin/preset/plugins/mime.lua | 2 +- yazi-plugin/preset/plugins/video.lua | 2 +- yazi-plugin/preset/plugins/zoxide.lua | 2 +- yazi-scheduler/src/process/process.rs | 4 ++-- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/yazi-plugin/preset/plugins/archive.lua b/yazi-plugin/preset/plugins/archive.lua index 09a29b8f..710b6b5c 100644 --- a/yazi-plugin/preset/plugins/archive.lua +++ b/yazi-plugin/preset/plugins/archive.lua @@ -9,7 +9,7 @@ function M:peek() return ya.preview_widgets(self, { ui.Text( code == 2 and "File list in this archive is encrypted" - or "Both `7z` and `7zz` commands failed to run.\nDo you have 7-zip installed?" + or "Starting both `7z` and `7zz` failed. Do you have 7-zip installed?" ):area(self.area), }) end diff --git a/yazi-plugin/preset/plugins/extract.lua b/yazi-plugin/preset/plugins/extract.lua index 72b7fe7a..abc69520 100644 --- a/yazi-plugin/preset/plugins/extract.lua +++ b/yazi-plugin/preset/plugins/extract.lua @@ -50,7 +50,7 @@ function M:try_with(from, pwd, to) local archive = require("archive") local child, code = archive.spawn_7z { "x", "-aou", "-sccUTF-8", "-p" .. pwd, "-o" .. tostring(tmp), tostring(from) } if not child then - fail("Both `7z` and `7zz` commands failed with error code %s.\nDo you have 7-zip installed?", code) + fail("Starting both `7z` and `7zz` failed, error code %s. Do you have 7-zip installed?", code) end local output, err = child:wait_with_output() diff --git a/yazi-plugin/preset/plugins/file.lua b/yazi-plugin/preset/plugins/file.lua index 30598c45..b2b7064b 100644 --- a/yazi-plugin/preset/plugins/file.lua +++ b/yazi-plugin/preset/plugins/file.lua @@ -8,7 +8,7 @@ function M:peek() if output then text = ui.Text.parse("----- File Type Classification -----\n\n" .. output.stdout) else - text = ui.Text(string.format("`%s` command returns %s", cmd, code)) + text = ui.Text(string.format("Starting `%s` failed with error code %s. Do you have file(1) installed?", cmd, code)) end ya.preview_widgets(self, { text:area(self.area):wrap(ui.Text.WRAP) }) diff --git a/yazi-plugin/preset/plugins/font.lua b/yazi-plugin/preset/plugins/font.lua index baf63d5b..090d81b0 100644 --- a/yazi-plugin/preset/plugins/font.lua +++ b/yazi-plugin/preset/plugins/font.lua @@ -40,7 +40,7 @@ function M:preload() }):spawn() if not child then - ya.err("`magick` command returns " .. tostring(code)) + ya.err(string.format("Starting `magick` failed with error code %s", code)) return 0 end diff --git a/yazi-plugin/preset/plugins/fzf.lua b/yazi-plugin/preset/plugins/fzf.lua index 42d5f360..d3428c28 100644 --- a/yazi-plugin/preset/plugins/fzf.lua +++ b/yazi-plugin/preset/plugins/fzf.lua @@ -10,7 +10,7 @@ local function entry() Command("fzf"):cwd(cwd):stdin(Command.INHERIT):stdout(Command.PIPED):stderr(Command.INHERIT):spawn() if not child then - return fail("Command `fzf` failed with error code %s. Do you have it installed?", err) + return fail("Starting `fzf` failed with error code %s. Do you have it installed?", err) end local output, err = child:wait_with_output() diff --git a/yazi-plugin/preset/plugins/magick.lua b/yazi-plugin/preset/plugins/magick.lua index 010d9444..6d853b0c 100644 --- a/yazi-plugin/preset/plugins/magick.lua +++ b/yazi-plugin/preset/plugins/magick.lua @@ -33,7 +33,7 @@ function M:preload() }):spawn() if not child then - ya.err("`magick` command returns " .. tostring(code)) + ya.err(string.format("Starting `magick` failed with error code %s", code)) return 0 end diff --git a/yazi-plugin/preset/plugins/mime.lua b/yazi-plugin/preset/plugins/mime.lua index 7041f649..982ae8bc 100644 --- a/yazi-plugin/preset/plugins/mime.lua +++ b/yazi-plugin/preset/plugins/mime.lua @@ -18,7 +18,7 @@ function M:fetch(job) local cmd = os.getenv("YAZI_FILE_ONE") or "file" local child, code = Command(cmd):args({ "-bL", "--mime-type", "--" }):args(urls):stdout(Command.PIPED):spawn() if not child then - ya.err(string.format("`%s` command returns %s", cmd, code)) + ya.err(string.format("Starting `%s` failed with error code %s", cmd, code)) return 0 end diff --git a/yazi-plugin/preset/plugins/video.lua b/yazi-plugin/preset/plugins/video.lua index f183f868..92e08d49 100644 --- a/yazi-plugin/preset/plugins/video.lua +++ b/yazi-plugin/preset/plugins/video.lua @@ -62,7 +62,7 @@ function M:preload() }):spawn() if not child then - ya.err("`ffmpeg` command returns " .. tostring(code)) + ya.err("Starting `ffmpeg` failed with error code " .. tostring(code)) return 0 end diff --git a/yazi-plugin/preset/plugins/zoxide.lua b/yazi-plugin/preset/plugins/zoxide.lua index 2d9eb590..1b7c63cb 100644 --- a/yazi-plugin/preset/plugins/zoxide.lua +++ b/yazi-plugin/preset/plugins/zoxide.lua @@ -101,7 +101,7 @@ local function entry() :spawn() if not child then - return fail("Command `zoxide` failed with error code %s. Do you have it installed?", err) + return fail("Starting `zoxide` failed with error code %s. Do you have it installed?", err) end local output, err = child:wait_with_output() diff --git a/yazi-scheduler/src/process/process.rs b/yazi-scheduler/src/process/process.rs index febf8785..26d8f4cd 100644 --- a/yazi-scheduler/src/process/process.rs +++ b/yazi-scheduler/src/process/process.rs @@ -21,7 +21,7 @@ impl Process { let (id, cmd) = (task.id, task.cmd.clone()); let result = super::shell(task.into()); if let Err(e) = result { - AppProxy::notify_warn(&cmd.to_string_lossy(), format!("Failed to run process: {e}")); + AppProxy::notify_warn(&cmd.to_string_lossy(), format!("Failed to start process: {e}")); return self.succ(id); } @@ -44,7 +44,7 @@ impl Process { Ok(_) => self.succ(id)?, Err(e) => { self.prog.send(TaskProg::New(id, 0))?; - self.fail(id, format!("Failed to run process: {e}"))?; + self.fail(id, format!("Failed to start process: {e}"))?; } }