Skip to content

Conversation

@jonaslagoni
Copy link
Contributor

@jonaslagoni jonaslagoni commented Dec 6, 2025

Note

Introduce centralized CodegenError system, apply it to config loading/validation and the generate command, and add comprehensive tests for error scenarios.

  • Core error handling (src/codegen/errors.ts):
    • Add CodegenError class, ErrorType enum, helpers (createConfigNotFoundError, createConfigParseError, createInvalidPresetError, createConfigValidationError, etc.), parseZodErrors, and enhanceError.
  • Configuration processing (src/codegen/configurations.ts):
    • Improve loadConfigFile to differentiate not-found vs. parse errors and throw typed errors with search locations.
    • Replace generic preset/validation errors with createInvalidPresetError and createConfigValidationError; log parsed Zod errors.
  • CLI (src/commands/generate.ts):
    • Wrap execution and watch-mode paths with enhanceError; output formatted, user-friendly messages.
  • Tests:
    • Add extensive unit tests for error helpers and parsing (test/codegen/errors.spec.ts).
    • Extend configuration tests for not-found/search behavior and validation logging (test/codegen/configurations.spec.ts).
    • Update generate command tests to cover error scenarios and cleanup; switch sample config to asyncapi.yaml.

Written by Cursor Bugbot for commit 7476943. This will update automatically on new commits. Configure here.

@netlify
Copy link

netlify bot commented Dec 6, 2025

Deploy Preview for the-codegen-project canceled.

Name Link
🔨 Latest commit 7476943
🔍 Latest deploy log https://app.netlify.com/projects/the-codegen-project/deploys/6935a10249acb80009f70d8a

@jonaslagoni jonaslagoni changed the title fix: improve error handling for no config fix: improve error handlin Dec 7, 2025
@jonaslagoni jonaslagoni changed the title fix: improve error handlin fix: improve error handling Dec 7, 2025
@jonaslagoni jonaslagoni changed the title fix: improve error handling fix: error handling Dec 7, 2025
@jonaslagoni jonaslagoni merged commit 9521573 into main Dec 7, 2025
20 checks passed
@jonaslagoni jonaslagoni deleted the improve_error_handling branch December 7, 2025 19:59
@jonaslagoni
Copy link
Contributor Author

🎉 This PR is included in version 0.56.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants