Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIO-7481: handle 504 response from service worker in offline mode for file request #5405

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/providers/storage/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const XHR = {
throw err;
}
if (!response.ok) {
if (response.status === 504) {
const error = new Error('Network request failed');
error.networkError = true;
throw error;
}

const message = await response.text();
throw new Error(message || 'Unable to sign file.');
}
Expand Down Expand Up @@ -95,6 +101,11 @@ const XHR = {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(serverResponse);
}
else if (xhr.status === 504) {
const error = new Error('Network request failed');
error.networkError = true;
reject(error);
}
else {
reject(xhr.response || 'Unable to upload file');
}
Expand Down
Loading