mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-27 08:06:33 +00:00
Update timeout detection
This commit is contained in:
@@ -15,11 +15,20 @@ HttpError.Error = {
|
|||||||
message = "Couldn't connect to the Rojo server.\n" ..
|
message = "Couldn't connect to the Rojo server.\n" ..
|
||||||
"Make sure the server is running -- use 'rojo serve' to run it!",
|
"Make sure the server is running -- use 'rojo serve' to run it!",
|
||||||
},
|
},
|
||||||
|
Timeout = {
|
||||||
|
message = "Request timed out.",
|
||||||
|
},
|
||||||
Unknown = {
|
Unknown = {
|
||||||
message = "Unknown error: {{message}}",
|
message = "Unknown error: {{message}}",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setmetatable(HttpError.Error, {
|
||||||
|
__index = function(_, key)
|
||||||
|
error(("%q is not a valid member of HttpError.Error"):format(tostring(key)), 2)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
function HttpError.new(type, extraMessage)
|
function HttpError.new(type, extraMessage)
|
||||||
extraMessage = extraMessage or ""
|
extraMessage = extraMessage or ""
|
||||||
local message = type.message:gsub("{{message}}", extraMessage)
|
local message = type.message:gsub("{{message}}", extraMessage)
|
||||||
@@ -48,6 +57,10 @@ function HttpError.fromErrorString(message)
|
|||||||
return HttpError.new(HttpError.Error.HttpNotEnabled)
|
return HttpError.new(HttpError.Error.HttpNotEnabled)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if lower:find("^httperror: timedout") then
|
||||||
|
return HttpError.new(HttpError.Error.Timeout)
|
||||||
|
end
|
||||||
|
|
||||||
if lower:find("^httperror: connectfail") then
|
if lower:find("^httperror: connectfail") then
|
||||||
return HttpError.new(HttpError.Error.ConnectFailed)
|
return HttpError.new(HttpError.Error.ConnectFailed)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user