Skip to content

Commit

Permalink
Show HTTP error in wget (#2037)
Browse files Browse the repository at this point in the history
  • Loading branch information
tizu69 authored Dec 22, 2024
1 parent 4dc649d commit 7e2f490
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ local function getFilename(sUrl)
return sUrl:match("/([^/]+)$")
end

local function get(sUrl)
local function get(url)
-- Check if the URL is valid
local ok, err = http.checkURL(url)
if not ok then
printError(err or "Invalid URL.")
return
end

write("Connecting to " .. sUrl .. "... ")
write("Connecting to " .. url .. "... ")

local response = http.get(sUrl)
local response, err = http.get(url)
if not response then
print("Failed.")
return nil
printError(err)
return
end

print("Success.")
Expand Down

0 comments on commit 7e2f490

Please sign in to comment.