Clean up error handling in plugin

This commit is contained in:
Lucien Greathouse
2019-01-23 18:10:53 -08:00
parent b1ddfc3a49
commit 87f6410877

View File

@@ -22,19 +22,19 @@ function Session.new(config)
api:connect() api:connect()
:andThen(function() :andThen(function()
if self.disconnected then if self.disconnected then
return Promise.resolve() return
end end
return api:read({api.rootInstanceId}) return api:read({api.rootInstanceId})
end)
:andThen(function(response) :andThen(function(response)
if self.disconnected then if self.disconnected then
return Promise.resolve() return
end end
self.reconciler:reconcile(response.instances, api.rootInstanceId, game) self.reconciler:reconcile(response.instances, api.rootInstanceId, game)
return self:__processMessages() return self:__processMessages()
end) end)
end)
:catch(function(message) :catch(function(message)
self.disconnected = true self.disconnected = true
self.onError(message) self.onError(message)