winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Use human-readable error codes when reporting out an error

Open dhruvchand opened this issue 7 months ago • 0 comments

Description of the new feature / enhancement

Current behavior

The winget CLI reports out an error code, like 1978335216 (from the list here https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md). Customers have to either run winget error <error number/code> to understand the error code, or they have to look up the error code in the abovementioned github link.

Proposed behavior: To make it easy for customers to understand the error without additional steps, we propose adding an errorDetails field, with the human readable error detail from https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md) in the cli output.

Example error: [2025-03-20T18:28:48.236360+00:00] Running package install: Postman.Postman [2025-03-20T18:28:49.372763+00:00] { [2025-03-20T18:28:49.372789+00:00] "Id": "Postman.Postman", [2025-03-20T18:28:49.372790+00:00] "Name": "Postman", [2025-03-20T18:28:49.372792+00:00] "Source": "winget", [2025-03-20T18:28:49.372793+00:00] "CorrelationData": "", [2025-03-20T18:28:49.372794+00:00] "InstallerErrorCode": 0, [2025-03-20T18:28:49.372797+00:00] "ExtendedErrorCode": { [2025-03-20T18:28:49.372798+00:00] "ErrorCode": -1978335216, [2025-03-20T18:28:49.372799+00:00] "TargetSite": null, [2025-03-20T18:28:49.372800+00:00] "Message": "", [2025-03-20T18:28:49.372801+00:00] "Data": { [2025-03-20T18:28:49.372900+00:00] "Description": null, [2025-03-20T18:28:49.372906+00:00] "RestrictedDescription": null, [2025-03-20T18:28:49.372907+00:00] "RestrictedErrorReference": null, [2025-03-20T18:28:49.372908+00:00] "RestrictedCapabilitySid": null, [2025-03-20T18:28:49.372911+00:00] "__RestrictedErrorObjectReference": null, [2025-03-20T18:28:49.372921+00:00] "__HasRestrictedLanguageErrorObject": false [2025-03-20T18:28:49.372922+00:00] }, [2025-03-20T18:28:49.372923+00:00] "InnerException": null, [2025-03-20T18:28:49.372926+00:00] "HelpLink": null, [2025-03-20T18:28:49.372927+00:00] "Source": null, [2025-03-20T18:28:49.372928+00:00] "HResult": -1978335216, [2025-03-20T18:28:49.372930+00:00] "StackTrace": null [2025-03-20T18:28:49.372931+00:00] }, [2025-03-20T18:28:49.372932+00:00] "RebootRequired": false, [2025-03-20T18:28:49.372934+00:00] "Status": "NoApplicableInstallers" [2025-03-20T18:28:49.372935+00:00] }

Proposed technical implementation details

No response

dhruvchand avatar Apr 30 '25 18:04 dhruvchand