Skip to content

Commit

Permalink
feat: report parse failure reasons (#1058)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukasz Gornicki <[email protected]>
  • Loading branch information
michael-ball-ctct and derberg authored Jan 4, 2024
1 parent 56ca8ad commit 028fbea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ 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(
`Diagnostic err: ${diag['message']} in path ${JSON.stringify(diag['path'])} starting `+
`L${diag['range']['start']['line'] + 1} C${diag['range']['start']['character']}, ending `+
`L${diag['range']['end']['line'] + 1} C${diag['range']['end']['character']}`
);
}
throw err;
} else {
this.asyncapi = document;
Expand Down

0 comments on commit 028fbea

Please sign in to comment.