generator icon indicating copy to clipboard operation
generator copied to clipboard

Proper Error handling mechanism for Baked-in Templates

Open Adi-204 opened this issue 4 months ago • 5 comments

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.

Adi-204 avatar Sep 02 '25 04:09 Adi-204

I would to work on this issue, can you guide me through it

batchu5 avatar Oct 26 '25 06:10 batchu5

@Adi-204

batchu5 avatar Oct 29 '25 10:10 batchu5

@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.

Adi-204 avatar Nov 01 '25 05:11 Adi-204

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

  1. Run generator with an unsupported language (e.g., rust if not supported).
  2. You should now see a clear error like: “Unsupported language: rust. Please choose a supported language.”
  3. Use a template with a missing default config value.
  4. Confirm that a human-friendly error explains exactly which field is missing.
  5. 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.

VIVEKDHEDHI021 avatar Nov 25 '25 09:11 VIVEKDHEDHI021

@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.

Jatin24062005 avatar Dec 06 '25 12:12 Jatin24062005