-
-
Notifications
You must be signed in to change notification settings - Fork 281
feat: improve error message when generating fromTemplate #1728 #1937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: improve error message when generating fromTemplate #1728 #1937
Conversation
🦋 Changeset detectedLatest commit: 6d8164c 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
@Shurtu-gal are the |
|
Kindly resolve the conflicts @Aditya-twd |
|
|
@AayushSaini101 Thanks for reviewing! I've resolved the conflicts and tested the error scenarios with the manual testing commands. The improved error messages are now working as expected. Feel free to review when you have time. |
|
@Shurtu-gal You're seems right! Moving this logic to dedicated error classes in |



Closes #1728
This PR improves error messages when
asyncapi generate fromTemplatefails while working with templates.Changes
GeneratorService.generateso that generator failures are surfaced as clearer, user‑friendly messages in the CLI.ENOENTon the template path) and explain that the template installation or local folder is invalid.A screenshot of the core issue being resolved
--

Notes
The generic banner text (
Something went wrong/Generation failed) is still printed by the existing CLI UI layer before the detailedGenerator Error: ...message. This PR focuses on improving the generator error details and template‑related messages.Manual testing
Manual testing is done
In order to see the issue this PR proposes to solve, follow these steps:
In the CLI repository, with a valid asyncapi.yaml in the current directory:
Run commands:
1. Non‑existent template name (template cannot be found/installed)
---> asyncapi generate fromTemplate ./asyncapi.yaml not-installed-template -o /tmp/out1
2. Unscoped template name (should be @asyncapi/html-template)
---> asyncapi generate fromTemplate ./asyncapi.yaml html-template -o /tmp/out2
3. Valid scoped template but unreachable/invalid registry URL (network/registry error)
---> asyncapi generate fromTemplate ./asyncapi.yaml @asyncapi/html-template --registry-url https://fake-registry.example.com -o /tmp/out3