Add github issue suggestion in user visible error - #41432
Conversation
…tion-in-user-visible-error
There was a problem hiding this comment.
Pull request overview
Adds GitHub issue-reporting guidance to localized WSL errors and standardizes affected test expectations.
Changes:
- Extends localized
MessageErrorCodemessages. - Adds shared
FormatErrorMessagetest helper. - Updates WSL and WSLC error-output tests.
The guidance does not cover all user-visible failures because several paths bypass MessageErrorCode, including direct OutputHelp/Terminal.Error output, InspectTasks not-found errors, and some WslClient errors.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Summary |
|---|---|
test/windows/wslc/e2e/WSLCE2EVolumeRemoveTests.cpp |
Updates volume-removal error expectations. |
test/windows/wslc/e2e/WSLCE2ESessionEnterTests.cpp |
Updates session error expectations. |
test/windows/wslc/e2e/WSLCE2EPushPullTests.cpp |
Updates image push/pull expectations. |
test/windows/wslc/e2e/WSLCE2ENetworkTests.cpp |
Updates network error expectations. |
test/windows/wslc/e2e/WSLCE2ENetworkCreateTests.cpp |
Updates network-creation expectations. |
test/windows/wslc/e2e/WSLCE2EImageTagTests.cpp |
Updates image-tag expectations. |
test/windows/wslc/e2e/WSLCE2EImageSaveTests.cpp |
Updates image-save expectations. |
test/windows/wslc/e2e/WSLCE2EImageDeleteTests.cpp |
Updates image-delete expectations. |
test/windows/wslc/e2e/WSLCE2EImageBuildTests.cpp |
Updates image-build expectations. |
test/windows/wslc/e2e/WSLCE2EHelpers.h |
Removes the old error formatter. |
test/windows/wslc/e2e/WSLCE2EGlobalTests.cpp |
Updates global error expectations. |
test/windows/wslc/e2e/WSLCE2EContainerStopTests.cpp |
Updates container-stop expectations. |
test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp |
Updates container-run expectations. |
test/windows/wslc/e2e/WSLCE2EContainerRemoveTests.cpp |
Updates container-removal expectations. |
test/windows/wslc/e2e/WSLCE2EContainerKillTests.cpp |
Updates container-kill expectations. |
test/windows/wslc/e2e/WSLCE2EContainerExecTests.cpp |
Updates container-exec expectations. |
test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp |
Updates container-creation expectations. |
test/windows/wslc/e2e/WSLCE2EContainerAttachTests.cpp |
Updates container-attach expectations. |
test/windows/UnitTests.cpp |
Updates WSL error expectations. |
test/windows/SimpleTests.cpp |
Updates sparse-VHD error expectations. |
test/windows/PolicyTests.cpp |
Updates policy error expectations. |
test/windows/PluginTests.cpp |
Updates plugin error expectations. |
test/windows/MountTests.cpp |
Updates mount error expectations. |
test/windows/InstallerTests.cpp |
Updates installer error expectations. |
test/windows/Common.h |
Declares the shared formatter. |
test/windows/Common.cpp |
Implements the shared formatter. |
localization/strings/en-US/Resources.resw |
Adds GitHub issue guidance to localized error messages. |
Suppressed comments (2)
localization/strings/en-US/Resources.resw:1173
- This updates only the en-US template.
Localization::LookupStringprefers an exact user-language entry before falling back, andlocalization/strings/en-GB/Resources.resw:1170-1174still contains the old two-lineMessageErrorCodevalue. As a result, en-GB and other locales with an existing translation will not show the GitHub suggestion. Please route this changed key through the localization regeneration process, or otherwise ensure the new suffix is available for existing locale entries.
If this error was unexpected, please consider searching for existing issues or filing a new issue at https://github.com/microsoft/WSL/issues.</value>
test/windows/Common.cpp:3153
- The migration leaves existing error assertions with raw
Error code:literals (for example,WSLCE2EVolumePruneTests.cpp:228,WSLCE2ENetworkCreateTests.cpp:91, andWSLCE2EVolumeCreateTests.cpp:87). Because these useStderrContainsSubstring, they still pass even if the new GitHub suffix is omitted and therefore do not cover the behavior introduced by this helper. Update those assertions to useFormatErrorMessageor add an exact assertion for the complete output.
std::wstring FormatErrorMessage(std::wstring_view message, std::wstring_view errorCode)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Suppressed comments (3)
localization/strings/en-US/Resources.resw:1173
- This updates only the
MessageErrorCodepath.WslClient.cppstill printsstrings.Messagedirectly forWSL_E_DEFAULT_DISTRO_NOT_FOUND/WSL_E_INVALID_USAGE, and usesGetErrorString(result)whenever noReportedErrorexists, so those user-visible failures will not include this GitHub guidance. If the stated goal is all user-visible errors, route these fallback/special-case paths through the same localized suffix or a shared formatter.
If this error was unexpected, please consider searching for existing issues or filing a new issue at https://github.com/microsoft/WSL/issues.</value>
localization/strings/en-US/Resources.resw:1173
- This updates only the en-US value, but
MessageErrorCodeis present in every localizedResources.resw;LookupStringselects an exact locale before falling back. For example, the checked-in en-GB value still contains only{}\nError code: {}, so en-GB and other localized installs will not show this new issue link. Please route the corresponding resource update through the localization pipeline (or otherwise preserve the link for localized values) before relying on this for all users.
If this error was unexpected, please consider searching for existing issues or filing a new issue at https://github.com/microsoft/WSL/issues.</value>
test/windows/wslc/e2e/WSLCE2ESessionEnterTests.cpp:119
- This update only affects failures that flow through
MessageErrorCode. The same CLI still has user-visible failures that bypass it—for example,SessionEnterCommandthrowsExecutionExceptionandCoreMainprintsee.Message()directly, soWSLCE2E_Help_ExecutionErrorDoesNotShowHelpstill has no GitHub suggestion. Please apply the common suffix to this path (and the parser/help error paths if “all user visible errors” is the intended scope), then update those assertions.
.Stderr = FormatErrorMessage(
wsl::shared::Localization::MessageWslcSessionStorageNotFound(storagePath), L"ERROR_PATH_NOT_FOUND"),
|
Deferring to Craig Loewen (@craigloewen-msft) to review this. The test changes look good |
Summary of the Pull Request
This PR adds a "search or file issue on github" suggestion in all user visible errors to:
This PR also updates all tests checking the error message to use a unified function for creating the expected error message.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Run the updated tests locally. No error message related failures.