Skip to content

fix(generate): preserve underlying error when validating registry URL#2025

Open
Satish11012007 wants to merge 3 commits intoasyncapi:masterfrom
Satish11012007:fix/2013-preserve-registry-error-cause
Open

fix(generate): preserve underlying error when validating registry URL#2025
Satish11012007 wants to merge 3 commits intoasyncapi:masterfrom
Satish11012007:fix/2013-preserve-registry-error-cause

Conversation

@Satish11012007
Copy link

Summary

Fixes an issue in registryValidation where the original error was swallowed and replaced with a generic message during registry URL validation.

Low-level errors such as DNS failures, network timeouts, TLS/SSL issues, proxy misconfiguration, or authentication errors were previously discarded. This made troubleshooting difficult for both CLI users and automated systems.

This change preserves the original error message and attaches the original Error object as cause, improving diagnosability without introducing breaking changes.


Root Cause

The catch block in registryValidation threw a new generic Error without preserving the original exception.

As a result:

  • The underlying message (e.g., ENOTFOUND, ECONNREFUSED, TLS error, timeout) was lost
  • Automated systems could not inspect the root cause
  • CLI users saw only a generic failure message

Changes Introduced

Inside the catch (err) block:

  • Extract the original error message:
    const message = err instanceof Error ? err.message : String(err);

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2026

⚠️ No Changeset found

Latest commit: 1d8e998

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sonarqubecloud
Copy link

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.

1 participant