Skip to content

fix: catch all requests exceptions in get_index to prevent unhandled NameResolutionError (closes #33691) - #33775

Closed
MORDEHAI BOTBIKA (botbikamordehai2-sketch) wants to merge 1 commit into
Azure:mainfrom
botbikamordehai2-sketch:fix/issue-33691-1784804830
Closed

MORDEHAI BOTBIKA (botbikamordehai2-sketch) wants to merge 1 commit into
Azure:mainfrom
botbikamordehai2-sketch:fix/issue-33691-1784804830

Conversation

@botbikamordehai2-sketch

Copy link
Copy Markdown

What

The az find command crashes with an unhandled NameResolutionError when DNS resolution fails for the extension index endpoint (e.g., app.aladdin.microsoft.com returns NXDOMAIN). The exception is not caught by the existing except clause, causing a Python traceback instead of a user-friendly error.

Fix

Replace (requests.exceptions.ConnectionError, requests.exceptions.HTTPError, ValueError) with (requests.exceptions.RequestException, ValueError) in the get_index() function. RequestException is the base class for all exceptions raised by the requests library, including DNS resolution failures, connection errors, timeouts, and HTTP errors. This ensures any network-related error is caught and converted to a CLIError with a clear message.

Closes #33691

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi MORDEHAI BOTBIKA (@botbikamordehai2-sketch),
Usually we only allow pull requests to be submitted to the dev branch, please double check your pull request target branch main.

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi MORDEHAI BOTBIKA (@botbikamordehai2-sketch),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@yonzhan

Copy link
Copy Markdown
Collaborator

az find

@necusjz

Copy link
Copy Markdown
Member

MORDEHAI BOTBIKA (@botbikamordehai2-sketch) thanks for your contribuation! however, it's covered by #33491 with a new backend service (will release in the next comming azure-cli version).

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test skipped

⏭️ Skipping the live test for this revision because no new test file was added (tests/**/test_*.py).

The live-test pipeline runs only the test files a PR changes, so there is nothing to execute for this commit. This is informational — a regression test is encouraged where it makes sense, but not required. If a test file is added in a later commit, the live test will run automatically.

@x-engineering-agent x-engineering-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI Review Summary

All checks are green for this PR. ✅

  • CI: 1/1 checks passed
  • Live test: not applicable (no runnable test file changes detected)

No issues found. Ready for maintainer review/merge.

@a0x1ab

Copy link
Copy Markdown
Member

MORDEHAI BOTBIKA (MORDEHAI BOTBIKA (@botbikamordehai2-sketch)) thanks for your contribuation! however, it's covered by #33491 with a new backend service (will release in the next comming azure-cli version).

MORDEHAI BOTBIKA (@botbikamordehai2-sketch) Based on this and PR #33491, closing out this PR as a duplicate solution

@a0x1ab Aditya Pujara (a0x1ab) added X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent and removed azure-client-tools-agent labels Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants