Skip to content

Commit

Permalink
fix(uploader): ContentUploader did not properly handle multiput errors (
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickpaul authored and Priyajeet Hora committed Jan 15, 2019
1 parent 4fd2c94 commit b5323bb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/api/uploads/MultiputPart.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @author Box
*/
import noop from 'lodash/noop';
import getProp from 'lodash/get';
import BaseMultiput from './BaseMultiput';
import { updateQueryParameters } from '../../util/url';
import { HTTP_PUT } from '../../constants';
Expand Down Expand Up @@ -237,9 +238,11 @@ class MultiputPart extends BaseMultiput {
return;
}

this.consoleLog(
`Upload failure ${error.message} for part ${this.toJSON()}. XHR state: ${this.xhr.xhr.readyState}.`,
);
const xhr_ready_state = getProp(this.xhr, 'xhr.readyState', null);
const xhr_status_text = getProp(this.xhr, 'xhr.statusText', '');

this.consoleLog(`Upload failure ${error.message} for part ${this.toJSON()}. XHR state: ${xhr_ready_state}.`);

const eventInfo = {
message: error.message,
part: {
Expand All @@ -248,9 +251,10 @@ class MultiputPart extends BaseMultiput {
index: this.index,
offset: this.offset,
},
xhr_ready_state: this.xhr.xhr.readyState,
xhr_status_text: this.xhr.xhr.statusText,
xhr_ready_state,
xhr_status_text,
};

const eventInfoString = JSON.stringify(eventInfo);
this.logEvent('part_failure', eventInfoString);

Expand Down

0 comments on commit b5323bb

Please sign in to comment.