Skip to content

Commit

Permalink
fix(sync): handle 502 (Bad Gateway) gracefully
Browse files Browse the repository at this point in the history
This is the proxies response when the request to the server fails.
It is often temporary - so it makes sense to keep trying.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Oct 2, 2024
1 parent ac87420 commit c8c8b5d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/services/PollingBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,10 @@ class PollingBackend {
} else if (e.response.status === 412) {
this.#syncService.emit('error', { type: ERROR_TYPE.LOAD_ERROR, data: e.response })
this.disconnect()
} else if (e.response.status === 403) {
} else if ([403, 404].includes(e.response.status)) {
this.#syncService.emit('error', { type: ERROR_TYPE.SOURCE_NOT_FOUND, data: {} })
this.disconnect()
} else if (e.response.status === 404) {
this.#syncService.emit('error', { type: ERROR_TYPE.SOURCE_NOT_FOUND, data: {} })
this.disconnect()
} else if (e.response.status === 503) {
} else if ([502, 503].includes(e.response.status)) {
this.increaseRefetchTimer()
this.#syncService.emit('error', { type: ERROR_TYPE.CONNECTION_FAILED, data: {} })
logger.error('Failed to fetch steps due to unavailable service', { error: e })
Expand Down

0 comments on commit c8c8b5d

Please sign in to comment.