CloudStorage: Log download failures (#7834)

Re #7354
reviewable/pr7840/r1
NiLuJe 3 years ago committed by GitHub
parent 002b4d4be9
commit 6b31b160a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -84,7 +84,7 @@ end
function DropBoxApi:downloadFile(path, token, local_path)
local data1 = "{\"path\": \"" .. path .. "\"}"
socketutil:set_timeout(socketutil.FILE_BLOCK_TIMEOUT, socketutil.FILE_TOTAL_TIMEOUT)
local code_return = socket.skip(1, http.request{
local code, _, status = socket.skip(1, http.request{
url = API_DOWNLOAD_FILE,
method = "GET",
headers = {
@ -94,7 +94,10 @@ function DropBoxApi:downloadFile(path, token, local_path)
sink = ltn12.sink.file(io.open(local_path, "w")),
})
socketutil:reset_timeout()
return code_return
if code ~= 200 then
logger.warn("DropBoxApi: Download failure:", status or code or "network unreachable")
end
return code
end
-- folder_mode - set to true when we want to see only folder.

@ -158,7 +158,7 @@ end
function WebDavApi:downloadFile(file_url, user, pass, local_path)
socketutil:set_timeout(socketutil.FILE_BLOCK_TIMEOUT, socketutil.FILE_TOTAL_TIMEOUT)
local code_return = socket.skip(1, http.request{
local code, _, status = socket.skip(1, http.request{
url = file_url,
method = "GET",
sink = ltn12.sink.file(io.open(local_path, "w")),
@ -166,7 +166,10 @@ function WebDavApi:downloadFile(file_url, user, pass, local_path)
password = pass,
})
socketutil:reset_timeout()
return code_return
if code ~= 200 then
logger.warn("WebDavApi: Download failure:", status or code or "network unreachable")
end
return code
end
return WebDavApi

Loading…
Cancel
Save