fix: catch all requests exceptions in get_index to prevent unhandled NameResolutionError (closes #33691) - #33775
Conversation
…NameResolutionError (closes Azure#33691)
|
Hi MORDEHAI BOTBIKA (@botbikamordehai2-sketch), |
|
Hi MORDEHAI BOTBIKA (@botbikamordehai2-sketch), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
az find |
|
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). |
Live test skipped⏭️ Skipping the live test for this revision because no new test file was added ( 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. |
MORDEHAI BOTBIKA (@botbikamordehai2-sketch) Based on this and PR #33491, closing out this PR as a duplicate solution |
What
The
az findcommand crashes with an unhandledNameResolutionErrorwhen DNS resolution fails for the extension index endpoint (e.g.,app.aladdin.microsoft.comreturns 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 theget_index()function.RequestExceptionis the base class for all exceptions raised by therequestslibrary, including DNS resolution failures, connection errors, timeouts, and HTTP errors. This ensures any network-related error is caught and converted to aCLIErrorwith a clear message.Closes #33691