mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
simplified error handling in progress routine
This commit is contained in:
parent
a7a36589a7
commit
e53a45822b
@ -526,7 +526,7 @@ var ReactS3FineUploader = React.createClass({
|
||||
// with the all function for iterables and essentially replace all original files
|
||||
// with their txt representative
|
||||
Q.all(convertedFilePromises)
|
||||
.progress(({index, value: {progress, handleError}}) => {
|
||||
.progress(({index, value: {progress, reject}}) => {
|
||||
|
||||
// hashing progress has been aborted from outside
|
||||
// To get out of the executing, we need to call reject from the
|
||||
@ -537,7 +537,7 @@ var ReactS3FineUploader = React.createClass({
|
||||
// In the promises catch method, we're then checking if the interruption
|
||||
// was due to that error or another generic one.
|
||||
if(this.state.hashingProgress === -1) {
|
||||
handleError(new Error(getLangText('Hashing canceled')));
|
||||
reject(new Error(getLangText('Hashing canceled')));
|
||||
}
|
||||
|
||||
// update file's progress
|
||||
|
@ -69,11 +69,13 @@ export function computeHashOfFile(file) {
|
||||
end = ((start + chunkSize) >= file.size) ? file.size : start + chunkSize;
|
||||
|
||||
// send progress
|
||||
// Due to the fact that progressHandler and notify are going to be removed in v2
|
||||
// of Q, the functionality of throwing errors in the progressHandler will not be implemented
|
||||
// anymore. To still be able to throw an error however, we can just expose the promise's reject
|
||||
// method to the .progress function to stop the execution immediately.
|
||||
notify({
|
||||
progress: start / file.size,
|
||||
handleError(err) {
|
||||
reject(err);
|
||||
}
|
||||
reject
|
||||
});
|
||||
|
||||
fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
|
||||
|
Loading…
Reference in New Issue
Block a user