Skip to content

fix: preserve error chain in registry validation (fixes #2013)#2163

Open
gavin913427-hash wants to merge 2 commits intoasyncapi:masterfrom
gavin913427-hash:fix/registry-error-details
Open

fix: preserve error chain in registry validation (fixes #2013)#2163
gavin913427-hash wants to merge 2 commits intoasyncapi:masterfrom
gavin913427-hash:fix/registry-error-details

Conversation

@gavin913427-hash
Copy link
Copy Markdown

What

Preserve the error chain in registry validation so users can see the full cause of failures.

Why

When registry validation fails, the original error was included in the message text but the error chain (cause property) was lost. This made it difficult to debug issues like:

  • Network timeouts
  • DNS failures
  • SSL errors
  • Proxy issues

How

  • Wrapped the original error as the cause property of the new error
  • This preserves the full error chain for debugging
  • The error message still includes the detail for backward compatibility

Changes

File Change
src/utils/generate/registry.ts Preserve error chain using cause property

Testing

# Test with invalid registry URL
asyncapi generate asyncapi.yaml @asyncapi/html-template --registry-url https://invalid.example.com
# Error now shows: "Can't fetch registryURL: https://invalid.example.com (...)"
# With cause chain preserved for debugging

Fixes #2013

When registry validation fails, the original error was included in the
message but the error chain (cause) was lost. Now the original error
is preserved as the cause property, making it easier to debug issues
like network timeouts, DNS failures, SSL errors, etc.

Fixes asyncapi#2013
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 3, 2026

🦋 Changeset detected

Latest commit: c41ddb1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/cli Patch

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 3, 2026

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

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

[BUG] Registry validation swallows error details, making debugging impossible

1 participant