aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-10-20 13:22:18 +0300
committerPeter Melnichenko <mpeterval@gmail.com>2016-10-20 13:22:18 +0300
commit20362f98249c1599c314562c8efb3a69bfd2017f (patch)
tree00b32cbf4072111d625863db5c6a08bea31c9265 /src
parentd1ac6eaf54222d927edd56e2f84c4eef2149b346 (diff)
downloadluarocks-20362f98249c1599c314562c8efb3a69bfd2017f.tar.gz
luarocks-20362f98249c1599c314562c8efb3a69bfd2017f.tar.bz2
luarocks-20362f98249c1599c314562c8efb3a69bfd2017f.zip
Slightly improve error messages in deploy/remove
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/repos.lua12
1 files changed, 7 insertions, 5 deletions
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)
174 return filename 174 return filename
175 end 175 end
176 end 176 end
177
178 return nil, table.concat(filenames, ", ") .. " not found"
177end 179end
178 180
179local function move_suffixed(from_file, to_file, suffix) 181local function move_suffixed(from_file, to_file, suffix)
180 local suffixed_from_file = find_suffixed(from_file, suffix) 182 local suffixed_from_file, err = find_suffixed(from_file, suffix)
181 if not suffixed_from_file then 183 if not suffixed_from_file then
182 return nil, "File not found" 184 return nil, "Could not move " .. from_file .. " to " .. to_file .. ": " .. err
183 end 185 end
184 186
185 suffix = suffixed_from_file:sub(#from_file + 1) 187 suffix = suffixed_from_file:sub(#from_file + 1)
@@ -188,14 +190,14 @@ local function move_suffixed(from_file, to_file, suffix)
188end 190end
189 191
190local function delete_suffixed(file, suffix) 192local function delete_suffixed(file, suffix)
191 local suffixed_file = find_suffixed(file, suffix) 193 local suffixed_file, err = find_suffixed(file, suffix)
192 if not suffixed_file then 194 if not suffixed_file then
193 return nil, "File not found", "not found" 195 return nil, "Could not remove " .. file .. ": " .. err, "not found"
194 end 196 end
195 197
196 fs.delete(suffixed_file) 198 fs.delete(suffixed_file)
197 if fs.exists(suffixed_file) then 199 if fs.exists(suffixed_file) then
198 return nil, "Failed deleting " .. suffixed_file, "fail" 200 return nil, "Failed deleting " .. suffixed_file .. ": file still exists", "fail"
199 end 201 end
200 202
201 return true 203 return true