response error msg
This commit is contained in:
@@ -95,12 +95,6 @@ local function parseGiteaURL(url)
|
|||||||
info.treeUrl =
|
info.treeUrl =
|
||||||
("%s%s/api/v1/repos/%s/%s/git/trees/%s?recursive=1")
|
("%s%s/api/v1/repos/%s/%s/git/trees/%s?recursive=1")
|
||||||
:format(info.protocol, info.origin, info.owner, info.repo, info.branch)
|
:format(info.protocol, info.origin, info.owner, info.repo, info.branch)
|
||||||
print()
|
|
||||||
print("protocol: ", info.protocol)
|
|
||||||
print("origin: ", info.origin)
|
|
||||||
print("owner: ", info.owner)
|
|
||||||
print("repo: ", info.repo)
|
|
||||||
print("treeUrl: ", info.treeUrl)
|
|
||||||
for k, v in pairs(info) do
|
for k, v in pairs(info) do
|
||||||
if v == "" or v == nil then
|
if v == "" or v == nil then
|
||||||
error("Could not parse " .. k .. " from link.")
|
error("Could not parse " .. k .. " from link.")
|
||||||
@@ -118,8 +112,8 @@ local function downloadFile(base, owner, repo, branch, path, target)
|
|||||||
req.headers = { Authorization = "token " .. GIT_TOKEN }
|
req.headers = { Authorization = "token " .. GIT_TOKEN }
|
||||||
end
|
end
|
||||||
|
|
||||||
local response = http.get(req)
|
local response, err = http.get(req)
|
||||||
if not response then error("Failed to download: " .. path) end
|
if not response then error("Failed to download: " .. path .. "due to: " .. err) end
|
||||||
|
|
||||||
local data = response.readAll()
|
local data = response.readAll()
|
||||||
response.close()
|
response.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user