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
Rework the error list and add a command to get error information #3615
Conversation
Does this work when the integer is negative? For example, the return code for |
I can add another automated test specifically for this scenario, but yes, it should work (I did test negatives manually). The only complicating factor is that the minus sign is interpreted as an argument specifier, so one needs to provide the "stop looking for arguments" override (
|
And here are the actual commands run against the dev build: PS > wingetdev error -- -1978335191
0x8a150029 : APPINSTALLER_CLI_ERROR_MANIFEST_VALIDATION_FAILURE
Manifest validation failed
PS > wingetdev error --input=-1978335191
0x8a150029 : APPINSTALLER_CLI_ERROR_MANIFEST_VALIDATION_FAILURE
Manifest validation failed |
REQUIRE(IsSameVolume(path1, path2)); | ||
REQUIRE(IsSameVolume(path5, path7)); | ||
if (IsSameVolume(path5, path5)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this if check intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is poorly considered, as it requires one to have a D
drive, otherwise it will fail. The underlying OS API fails if the path does not reference an extant volume, and our function treats that as a sort of NaN
result and always returns false if either path results in it. This means that D:\path1
and D:\path2
will result in false
if D
is not a volume. As a minimal workaround to that, I attempted to determine if D
exists by checking if equal paths point to the same volume.
The test would be better if it constructed the paths based on the existing volumes rather than hard coding specific paths. But I was just trying to put a bandaid on the issue.
Change
This change reworks the error description switch statement into a sorted array of data. We then use binary search to find the appropriate description when needed. In addition, it now supports these values being localized.
This change also adds the
error
command (hidden) to enable a somewhat easier path to getting error information specific to winget. The command takes in a single value. If this is wholly a number, it is treated as the error number itself. If it is not a number, it is treated as a string to search within the symbols and descriptions of the winget errors.Validation
Added a unit test to ensure that the error data is sorted.
Added E2E tests for the error command.