Backport #847 to 7.4 (gracefully handle gateway timeouts) (#851)

This PR adds a fix for gateway timeout handling to the 7.4.x branch

Co-authored-by: boatbomber <zack@boatbomber.com>
This commit is contained in:
Kenneth Loeffler
2024-02-03 20:30:10 -08:00
committed by GitHub
parent 2798610afd
commit f68beab1df
3 changed files with 23 additions and 7 deletions

View File

@@ -30,8 +30,13 @@ local function performRequest(requestParams)
end)
if success then
Log.trace("Request {} success, status code {}", requestId, response.StatusCode)
resolve(HttpResponse.fromRobloxResponse(response))
Log.trace("Request {} success, response {:#?}", requestId, response)
local httpResponse = HttpResponse.fromRobloxResponse(response)
if httpResponse:isSuccess() then
resolve(httpResponse)
else
reject(HttpError.fromResponse(httpResponse))
end
else
Log.trace("Request {} failure: {:?}", requestId, response)
reject(HttpError.fromRobloxErrorString(response))
@@ -63,4 +68,4 @@ function Http.jsonDecode(source)
return HttpService:JSONDecode(source)
end
return Http
return Http