Skip to content

Commit

Permalink
Properly fail instead of hanging if a chunk fails to upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Moore committed Sep 18, 2019
1 parent a2e78b6 commit 3212d18
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/S3BlobUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,13 @@
request.contentLength = thisClass.length;

request.onreadystatechange = function() {
if (request.readyState === 4 && request.status === 200) {
//Done with a chunk
thisClass.onDone(request.contentLength);
if (request.readyState === 4) {
if (request.status === 200) {
//Done with a chunk
thisClass.onDone(request.contentLength);
return;
}
thisClass.onFail(`Upload failed with status code: ${request.status}`);
}
};
request.upload.onprogress = function(e) {
Expand Down

0 comments on commit 3212d18

Please sign in to comment.