mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Plugin cleanup, and better message distinction
This commit is contained in:
parent
a30937f009
commit
63ea182f94
3 changed files with 13 additions and 4 deletions
|
|
@ -3,6 +3,7 @@ local Promise = require(script.Parent.Parent.modules.Promise)
|
|||
local Config = require(script.Parent.Config)
|
||||
local Version = require(script.Parent.Version)
|
||||
local Http = require(script.Parent.Http)
|
||||
local HttpError = require(script.Parent.HttpError)
|
||||
|
||||
local ApiContext = {}
|
||||
ApiContext.__index = ApiContext
|
||||
|
|
@ -104,6 +105,10 @@ function ApiContext:retrieveMessages()
|
|||
|
||||
return self:retrieveMessages()
|
||||
end, function(err)
|
||||
if err.type == HttpError.Error.Timeout then
|
||||
return self:retrieveMessages()
|
||||
end
|
||||
|
||||
self.connected = false
|
||||
|
||||
return Promise.reject(err)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ HttpError.Error = {
|
|||
message = "Rojo plugin couldn't connect to the Rojo server.\n" ..
|
||||
"Make sure the server is running -- use 'Rojo serve' to run it!",
|
||||
},
|
||||
Timeout = {
|
||||
message = "Rojo timed out during a request.",
|
||||
},
|
||||
Unknown = {
|
||||
message = "Rojo encountered an unknown error: {{message}}",
|
||||
},
|
||||
|
|
@ -44,7 +47,11 @@ function HttpError.fromErrorString(err)
|
|||
end
|
||||
|
||||
if err:find("^curl error") then
|
||||
return HttpError.new(HttpError.Error.ConnectFailed)
|
||||
if err:find("couldn't connect to server") then
|
||||
return HttpError.new(HttpError.Error.ConnectFailed)
|
||||
elseif err:find("timeout was reached") then
|
||||
return HttpError.new(HttpError.Error.Timeout)
|
||||
end
|
||||
end
|
||||
|
||||
return HttpError.new(HttpError.Error.Unknown, err)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ function Session.new()
|
|||
|
||||
for id, instance in pairs(instances) do
|
||||
if id ~= "0" then
|
||||
print("parent", created[id], created[tostring(instance.parent)])
|
||||
created[id].Parent = created[tostring(instance.parent)]
|
||||
end
|
||||
end
|
||||
|
|
@ -57,8 +56,6 @@ function Session.new()
|
|||
end
|
||||
|
||||
api = ApiContext.new(REMOTE_URL, function(message)
|
||||
print("got message", message)
|
||||
|
||||
if message.type == "InstanceChanged" then
|
||||
print("Instance", message.id, "changed!")
|
||||
readAll()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue