Skip to content

Commit

Permalink
feat: Report parse failure reasons
Browse files Browse the repository at this point in the history
For [](#1051)

I opted for the more basic logging style - I don't know enough about
the diagnostics objects to be sure that they'll always contain the same
fields, so erred on the side of caution rather than trying to access
fields within fields that aren't guaranteed to exist (as well as
including all available information, regardless of what is provided).
  • Loading branch information
michael-ball-ctct committed Oct 30, 2023
1 parent 3dc4e9e commit 506dfe8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Generator {
* @example
* await generator.generate(myAsyncAPIdocument);
* console.log('Done!');
*
*
* @example
* generator
* .generate(myAsyncAPIdocument)
Expand Down Expand Up @@ -353,6 +353,9 @@ class Generator {
if (!document) {
const err = new Error('Input is not a correct AsyncAPI document so it cannot be processed.');
err.diagnostics = diagnostics;
for (const diag of diagnostics) {
console.error('Diagnotic err:', diag);
}
throw err;
} else {
this.asyncapi = document;
Expand Down

0 comments on commit 506dfe8

Please sign in to comment.