Issue with empty roots bundle

This commit is contained in:
Luis Tejeda
2022-06-03 16:34:23 -05:00
parent 0bba8a4895
commit 7b5e68b2b6
3 changed files with 53 additions and 34 deletions

View File

@@ -4931,23 +4931,21 @@ module.exports = {
try {
res.output.data = this.mapProcessRelatedFiles(inputRelatedFiles.rootFiles, inputRelatedFiles.data,
inputRelatedFiles.origin, version, inputRelatedFiles.bundleFormat, toBundle);
if (res.output.data === undefined || res.output.data.length === 0 ||
res.output.data.result === false) {
res.result = false;
}
return res;
}
catch (error) {
if (error instanceof ParseError) {
return {
result: false,
reason: error.message
};
}
else {
throw (error);
}
let newError = new Error('There was an error during the process');
newError.stack = error.stack;
throw (newError);
}
if (res.output.data.result === false) {
res.result = res.output.data.result;
res.error = res.output.data.error;
}
return res;
}
else {
return res;
@@ -4957,11 +4955,12 @@ module.exports = {
/**
*
* @description Validates the input for multi file APIs
* @param {string} processInput - Process input data
* @param {object} processInput - Process input data
* @param {boolean} bundleProcess - Wheter the process input corresponds to bundel process
*
* @returns {undefined} - nothing
*/
validateInputMultiFileAPI(processInput) {
validateInputMultiFileAPI(processInput, bundleProcess = false) {
if (_.isEmpty(processInput)) {
throw new Error('Input object must have "type" and "data" information');
}
@@ -4974,5 +4973,8 @@ module.exports = {
if (processInput.data[0].path === '') {
throw new Error('"Path" of the data element should be provided');
}
if (bundleProcess && (!processInput.rootFiles || processInput.rootFiles.length === 0)) {
throw new Error('"RootFiles" parameter should be provided');
}
}
};