plugin: Improve HTTP error messages by using response body

This commit is contained in:
Lucien Greathouse
2019-12-19 14:41:57 -08:00
parent 1968e1fdb7
commit 57d5610a58

View File

@@ -19,8 +19,9 @@ end
local function rejectFailedRequests(response)
if response.code >= 400 then
-- TODO: Nicer error types for responses, using response JSON if valid.
return Promise.reject(tostring(response.code))
local message = string.format("HTTP %s:\n%s", tostring(response.code), response.body)
return Promise.reject(message)
end
return response