improve error message in case the lua script can't download a file

Now prints the actual error message from the http library instead of a
generic "Could not connect" message.
This commit is contained in:
Gerd v. Egidy 2022-08-07 12:53:16 +02:00
parent bc797d36b9
commit 81db3b13db

View file

@ -169,7 +169,8 @@ function download_file(fileurl)
local headers, stream = req:go(req_timeout)
if headers == nil then
io.stderr:write(string.format("Failed to download %s: Could not connect\n", fileurl))
--- the second return variable (=stream) contains the error message in case of an error
io.stderr:write(string.format("Failed to download %s: %s\n", fileurl, stream))
return nil
end