feat: improve error message when generating fromTemplate #1728 #1937
+61
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



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