1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Catch non ok response codes and set the status to error and log the error. (#5236)

Co-authored-by: John Bolliger <john.bolliger@mx.com>
This commit is contained in:
John Bolliger 2022-03-09 17:21:13 -07:00 committed by GitHub
parent 10598b5206
commit 70da442444
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,7 +91,19 @@ function updateLivePollButton() {
function livePollCallback() { function livePollCallback() {
clearTimeout(livePollTimer); clearTimeout(livePollTimer);
fetch(window.location.href).then(resp => resp.text()).then(replacePage).finally(scheduleLivePoll) fetch(window.location.href)
.then(checkResponse)
.then(resp => resp.text())
.then(replacePage)
.catch(showError)
.finally(scheduleLivePoll)
}
function checkResponse(resp) {
if (!resp.ok) {
throw response.error();
}
return resp
} }
function scheduleLivePoll() { function scheduleLivePoll() {
@ -111,3 +123,7 @@ function replacePage(text) {
addListeners(); addListeners();
} }
function showError(error) {
console.error(error)
}