Skip to content

Commit 171e04f

Browse files
committed
fix: safer network error response status check
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 609f8f1 commit 171e04f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/assistant.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,11 @@ export async function pollTaskPosition(taskId, obj, callback = updateTaskPositio
493493
return
494494
}
495495
console.debug('[assistant] pollPosition request failed', error)
496-
if (error.status === 404) {
496+
if (error.status === 404 || error?.response?.status === 404) {
497497
stopPolling()
498498
reject(new Error('task-not-found'))
499499
return
500-
} else if (error.status === 412) {
500+
} else if (error.status === 412 || error?.response?.status === 412) {
501501
stopPolling()
502502
resolve()
503503
return
@@ -549,7 +549,7 @@ export async function pollTask(taskId, obj, updateOutput = true, callback = upda
549549
return
550550
}
551551
console.debug('[assistant] poll request failed', error)
552-
if (error.status === 404) {
552+
if (error.status === 404 || error?.response?.status === 404) {
553553
if (window.assistantPollTaskId === taskId) {
554554
clearInterval(window.assistantPollTimerId)
555555
window.assistantPollTimerId = null

0 commit comments

Comments
 (0)