From 20362f98249c1599c314562c8efb3a69bfd2017f Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Thu, 20 Oct 2016 13:22:18 +0300 Subject: Slightly improve error messages in deploy/remove --- src/luarocks/repos.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index 161cdd8a..c5f157c4 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua @@ -174,12 +174,14 @@ local function find_suffixed(file, suffix) return filename end end + + return nil, table.concat(filenames, ", ") .. " not found" end local function move_suffixed(from_file, to_file, suffix) - local suffixed_from_file = find_suffixed(from_file, suffix) + local suffixed_from_file, err = find_suffixed(from_file, suffix) if not suffixed_from_file then - return nil, "File not found" + return nil, "Could not move " .. from_file .. " to " .. to_file .. ": " .. err end suffix = suffixed_from_file:sub(#from_file + 1) @@ -188,14 +190,14 @@ local function move_suffixed(from_file, to_file, suffix) end local function delete_suffixed(file, suffix) - local suffixed_file = find_suffixed(file, suffix) + local suffixed_file, err = find_suffixed(file, suffix) if not suffixed_file then - return nil, "File not found", "not found" + return nil, "Could not remove " .. file .. ": " .. err, "not found" end fs.delete(suffixed_file) if fs.exists(suffixed_file) then - return nil, "Failed deleting " .. suffixed_file, "fail" + return nil, "Failed deleting " .. suffixed_file .. ": file still exists", "fail" end return true -- cgit v1.2.3-55-g6feb