Skip to content

Commit

Permalink
fix: added file parsing error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Adi-204 committed Jan 24, 2025
1 parent 5f2476c commit 4955a75
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/commands/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ export default class Inspect extends Command {
throw new Error('Proxy Connection Error: Unable to establish a connection to the proxy check hostName or PortNumber.');
}
else {
this.error(new ValidationError({type: 'invalid-file',filepath: filePath}));
this.error(new ValidationError({ type: 'invalid-file', filepath: filePath }));
}
}
const { document } = await parse(this, this.specFile);
const { document, status } = await parse(this, this.specFile);
if (!document || status === 'invalid') {
this.log('Input is not a correct AsyncAPI document so it cannot be processed.');
return;
}
const channels = await numberOfChannels(document);
const servers = await numberOfServers(document);
const components = await numberOfComponents(document);
Expand Down

0 comments on commit 4955a75

Please sign in to comment.