mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Throw errors instead of returning reason
Throw errors instead of returning reason and throw errors if the entry has no root files
This commit is contained in:
@@ -4921,26 +4921,23 @@ 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.result === false ||
|
||||
res.output.data.length === 0) {
|
||||
res.result = false;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof ParseError) {
|
||||
return {
|
||||
result: false,
|
||||
reason: error.message
|
||||
};
|
||||
}
|
||||
else {
|
||||
throw (error);
|
||||
}
|
||||
}
|
||||
if (res.output.data.result === false) {
|
||||
res.result = res.output.data.result;
|
||||
res.error = res.output.data.error;
|
||||
let newError = new Error('There was an error during the process');
|
||||
newError.stack = error.stack;
|
||||
throw (newError);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else {
|
||||
return res;
|
||||
throw new Error('Input should have at least one root file');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user