Skip to content

Commit

Permalink
change parser to throw errors to callers and increment generator version
Browse files Browse the repository at this point in the history
  • Loading branch information
Raisel Melian committed Feb 7, 2019
1 parent 945f3e0 commit 0574156
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,36 +59,36 @@ async function parse (filePath) {
content = JSON.stringify(filePath);
} else {
console.error(`Could not find a valid asyncapi definition: ${filePath}`);
return;
throw `Could not find a valid asyncapi definition: ${filePath}`;
}
} catch (e) {
console.error('Can not load the content of the AsyncAPI specification file');
console.error(e);
return;
throw e;
}

try {
parsedContent = parseContent(content);
} catch (e) {
console.error('Can not parse the content of the AsyncAPI specification file');
console.error(e);
return;
throw e;
}

try {
dereferencedJSON = await dereference(parsedContent);
} catch (e) {
console.error('Can not dereference the JSON obtained from the content of the AsyncAPI specification file');
console.error(e);
return;
throw e;
}

try {
bundledJSON = await bundle(dereferencedJSON);
} catch (e) {
console.error('Can not bundle the JSON obtained from the content of the AsyncAPI specification file');
console.error(e);
return;
throw e;
}

try {
Expand All @@ -97,7 +97,7 @@ async function parse (filePath) {
} catch (e) {
console.error('Invalid JSON obtained from the content of the AsyncAPI specification file');
console.error(e);
return;
throw e;
}

return JSON.parse(JSON.stringify(parsed));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asyncapi-generator",
"version": "0.6.0",
"version": "0.6.1",
"description": "The AsyncAPI generator. It can generate documentation, code, anything!",
"main": "./lib/generator.js",
"bin": {
Expand Down

0 comments on commit 0574156

Please sign in to comment.