ImportHandler: Use return reject(...)
to avoid double settle
This commit is contained in:
parent
e01059dce5
commit
908635a1de
1 changed files with 5 additions and 6 deletions
|
@ -99,16 +99,15 @@ const doImport = async (req, res, padId) => {
|
||||||
|
|
||||||
// I hate doing indexOf here but I can't see anything to use...
|
// I hate doing indexOf here but I can't see anything to use...
|
||||||
if (err && err.stack && err.stack.indexOf('maxFileSize') !== -1) {
|
if (err && err.stack && err.stack.indexOf('maxFileSize') !== -1) {
|
||||||
reject('maxFileSize');
|
return reject('maxFileSize');
|
||||||
}
|
}
|
||||||
|
|
||||||
reject('uploadFailed');
|
return reject('uploadFailed');
|
||||||
}
|
}
|
||||||
if (!files.file) { // might not be a graceful fix but it works
|
if (!files.file) { // might not be a graceful fix but it works
|
||||||
reject('uploadFailed');
|
return reject('uploadFailed');
|
||||||
} else {
|
|
||||||
resolve(files.file.path);
|
|
||||||
}
|
}
|
||||||
|
resolve(files.file.path);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -177,7 +176,7 @@ const doImport = async (req, res, padId) => {
|
||||||
// catch convert errors
|
// catch convert errors
|
||||||
if (err) {
|
if (err) {
|
||||||
console.warn('Converting Error:', err);
|
console.warn('Converting Error:', err);
|
||||||
reject('convertFailed');
|
return reject('convertFailed');
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue