Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az_cli_universal_dependency: Enhance error messaging #934

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

makubacki
Copy link
Member

  1. If the azure-devops extension is not installed, provide a URL with installation instructions. This link can directly be clicked in many shell environments.
  2. If an error occurs running the Azure CLI then show the error message to the user. This often has helpful instructions for what needs to be done to resolve the error. Example shown below.

Before:

    raise Exception("{0} failed with Return Code: {1}".format(cmd, returncode_str))
	Exception: az artifacts universal download --organization https://dev.azure.com/Organization/
	  --feed FEED --name NAME --version 0.0.1 --path "PATH" failed with Return Code: 0x00000001

After:

    raise Exception(
      Exception:
        Command "az artifacts universal download --organization https://dev.azure.com/Organization/
	      --feed FEED --name NAME --version 0.0.1 --path "PATH"" failed with 1.

      ERROR: Failed to update Universal Packages tooling.
        Before you can run Azure DevOps commands, you need to run the login command(az login if using
		AAD/MSA identity else az devops login if using PAT token) to setup credentials.
		Please see https://aka.ms/azure-devops-cli-auth for more information.

@makubacki makubacki requested a review from Javagedes February 10, 2025 14:56
@makubacki makubacki force-pushed the enhance_az_cli_error_output branch from 4f2957c to 2577d5d Compare February 10, 2025 15:01
@Javagedes Javagedes added the enhancement New feature or request label Feb 10, 2025
@Javagedes Javagedes added this to the v0.28.3 milestone Feb 10, 2025
1. If the `azure-devops` extension is not installed, provide a URL
   with installation instructions. This link can directly be clicked
   in many shell environments.
2. If an error occurs running the Azure CLI then show the error
   message to the user. This often has helpful instructions for what
   needs to be done to resolve the error. Example shown below.

Before:

```
    raise Exception("{0} failed with Return Code: {1}".format(cmd, returncode_str))
	Exception: az artifacts universal download --organization https://dev.azure.com/Organization/
	  --feed FEED --name NAME --version 0.0.1 --path "PATH" failed with Return Code: 0x00000001
```

After:

```
    raise Exception(
      Exception:
        Command "az artifacts universal download --organization https://dev.azure.com/Organization/
	      --feed FEED --name NAME --version 0.0.1 --path "PATH"" failed with 1.

      ERROR: Failed to update Universal Packages tooling.
        Before you can run Azure DevOps commands, you need to run the login command(az login if using
		AAD/MSA identity else az devops login if using PAT token) to setup credentials.
		Please see https://aka.ms/azure-devops-cli-auth for more information.
```

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki makubacki force-pushed the enhance_az_cli_error_output branch from 2577d5d to e050c66 Compare February 14, 2025 15:18
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.49%. Comparing base (bf643b0) to head (e050c66).
Report is 129 commits behind head on master.

Files with missing lines Patch % Lines
...ronment/extdeptypes/az_cli_universal_dependency.py 80.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #934      +/-   ##
==========================================
+ Coverage   78.75%   79.49%   +0.74%     
==========================================
  Files          49       41       -8     
  Lines        4909     5058     +149     
==========================================
+ Hits         3866     4021     +155     
+ Misses       1043     1037       -6     
Files with missing lines Coverage Δ
...ronment/extdeptypes/az_cli_universal_dependency.py 72.47% <80.00%> (+28.99%) ⬆️

... and 48 files with indirect coverage changes

@makubacki
Copy link
Member Author

@Javagedes, pushed the fix for the earlier unit test failure.

@Javagedes Javagedes merged commit dc10b16 into tianocore:master Feb 14, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants