diff --git a/index.js b/index.js index fc42791..a457d58 100644 --- a/index.js +++ b/index.js @@ -67,13 +67,24 @@ module.exports = { _.forEach(convertedSpecs, (convertedSpec) => { if (convertedSpec.result) { - conversionResult = convertedSpec.result; - convertedCollections.push(convertedSpec.output[0]); + let result; + conversionResult = conversionResult || convertedSpec.result; + + function returnCollections (resultSpec) { + if (resultSpec.type === 'collection') { + return true; + } + } + + // filtering out the collections from the convertedSpec + result = convertedSpec.output.filter(returnCollections); + result.forEach((collection) => { + convertedCollections.push(collection); + }); } else { - conversionResult = convertedSpec.result; + conversionResult = conversionResult || convertedSpec.result; reasonForFail = convertedSpec.reason; - return false; // it will break out from the loop } }); diff --git a/lib/parse.js b/lib/parse.js index 2b89a9f..fd4e1f8 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -162,11 +162,11 @@ module.exports = { return yamlParse.parse(content, { prettyErrors: true }); } catch (err) { - throw new ReadError('\nLine: ' + err.linePos.start.line + ', col: ' + + throw new Error('\nLine: ' + err.linePos.start.line + ', col: ' + err.linePos.start.col + ' ' + err.message); } }, (err) => { - throw new OpenError(err.message); + throw new Error(err.message); }) .then((unresolved) => { if (options.resolve === true) {