Skip to content

Commit

Permalink
Let apicontext error bubble up since ServeSession now knows when to i…
Browse files Browse the repository at this point in the history
…gnore it
  • Loading branch information
boatbomber committed Jul 15, 2023
1 parent e9b53c8 commit 7ad1f68
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions plugin/src/ApiContext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ local validateApiInfo = Types.ifEnabled(Types.ApiInfoResponse)
local validateApiRead = Types.ifEnabled(Types.ApiReadResponse)
local validateApiSubscribe = Types.ifEnabled(Types.ApiSubscribeResponse)

--[[
Returns a promise that will never resolve nor reject.
]]
local function hangingPromise()
return Promise.new(function() end)
end

local function rejectFailedRequests(response)
if response.code >= 400 then
local message = string.format("HTTP %s:\n%s", tostring(response.code), response.body)
Expand Down Expand Up @@ -212,12 +205,8 @@ function ApiContext:retrieveMessages()
local function sendRequest()
local request = Http.get(url)
:catch(function(err)
if err.type == Http.Error.Kind.Timeout then
if self.__connected then
return sendRequest()
else
return hangingPromise()
end
if err.type == Http.Error.Kind.Timeout and self.__connected then
return sendRequest()
end

return Promise.reject(err)
Expand Down

0 comments on commit 7ad1f68

Please sign in to comment.