Repository navigation
fix(diff): surface parser failures instead of empty ValidationError (fixes #2222) - #2313
abhinavkdeval08-design wants to merge 6 commits into
Conversation
…ixes asyncapi#2222) Signed-off-by: Abhinav Deval <abhinavkdeval08@gmail.com>
🦋 Changeset detectedLatest commit: 31ddbb5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
c7e4a83 to
051343e
Compare
Signed-off-by: Abhinav Deval <abhinavkdeval08@gmail.com>
|
Update:
PTAL whenever you have bandwidth! 🙏 |
|
Hi team! 👋 Just a quick update on this PR:
Whenever you have some bandwidth, could you please review and take a look? |
|
|
Merged latest Checks and the changeset are in place. Could you take a look when you get a chance? cc @Souvikns @princerajpoot20 |



Description
This PR fixes an issue where running
asyncapi diffwith a malformed or unparsable document exited with code 1 and printed a bare, emptyValidationError:without any diagnostic error message.Root Cause
parseDocumentsfunction insrc/apps/cli/commands/diff.tswas constructing aValidationErrorwithtype: 'invalid-file', which is intended for missing files and ignores theerrpayload entirely. It has been corrected to use'parser-error'.catchblock inrun()was wrapping unknown errors into a newValidationErrorwithout checking if the caught error was already aValidationError. Additionally,buildErrorevaluated to an empty string when encountering plain string errors or generic error shapes.Changes Proposed
src/apps/cli/commands/diff.tsto usetype: 'parser-error'inparseDocuments.error instanceof ValidationErrorpass-through check inrun()'s catch block to prevent double-wrapping.src/errors/validation-error.ts'sbuildErrormethod to properly surface plain strings and error messages.Testing