Proper Error handling mechanism for Baked-in Templates
We have @asyncapi/generator-components which is used in template development but currently we don't support all languages and protocol. In implementation their is no error handling and we need to solve this problem as provide accurate error messages to users is crucial.
I would to work on this issue, can you guide me through it
@Adi-204
@varshitha-besthu this issue requires thorough discussion, research, and a deep understanding of template development. I’d recommend picking another issue for now. However, if you still wish to work on this one, please first share your proposed approach for feedback, and proceed with creating a PR only after the maintainers agree that the approach is suitable.
I’m really interested in this issue and would love to contribute to improving the error-handling experience. I believe solving this will make the generator more reliable and much easier for developers to work with
Pull Request: Improve Error Handling for Unsupported Languages & Protocols
Summary This PR improves the error handling inside @asyncapi/generator-components. Currently, when a template uses an unsupported language or protocol, the generator either fails silently or throws unhelpful errors. This PR adds clear, user-friendly error messages to make the development experience smoother.
Problem
- Unsupported languages and protocols do not show clear errors
- The generator sometimes fails silently or with confusing stack traces
- Developers struggle to understand what went wrong
- Missing default config values are not validated properly
This leads to poor debugging, inconsistent behavior, and frustration for template developers.
Solution This PR introduces:
- Validation checks for supported languages and protocols
- Clear, human-friendly error messages instead of silent failures
- Proper try/catch blocks to avoid swallowed errors
- Config loader improvements so missing defaults show explicit warnings
- More reliable feedback during template development
These updates make it easier to identify what went wrong and guide the user toward a fix.
How to Test
- Run generator with an unsupported language (e.g., rust if not supported).
- You should now see a clear error like: “Unsupported language: rust. Please choose a supported language.”
- Use a template with a missing default config value.
- Confirm that a human-friendly error explains exactly which field is missing.
- Run a valid setup to ensure normal behavior is unchanged.
Related Issue Fixes: “Lack of error handling in @asyncapi/generator-components when unsupported languages/protocols are used.”
Notes If needed, more improvements can be added to extend protocol/language support.
@Adi-204 i created a Pull Request for showing how i will approach rest of the @asyncapi/generator-components to update error handling for the unsupported languages and protocol. Please let me know if I can proceed with the full implementation.