Don't return catch-all error messages for non-WSL specific error codes#40163
Merged
OneBlue merged 11 commits intofeature/wsl-for-appsfrom Apr 14, 2026
Merged
Don't return catch-all error messages for non-WSL specific error codes#40163OneBlue merged 11 commits intofeature/wsl-for-appsfrom
OneBlue merged 11 commits intofeature/wsl-for-appsfrom
Conversation
OneBlue
commented
Apr 11, 2026
| return Localization::MessageNoDefaultDistro(); | ||
|
|
||
| case HRESULT_FROM_WIN32(WSAECONNABORTED): | ||
| case HRESULT_FROM_WIN32(ERROR_SHUTDOWN_IN_PROGRESS): |
Collaborator
Author
There was a problem hiding this comment.
Open to feedback on this: I chose to remove this because it can be misleading since a closed socket isn't necessarily a sign that the distro is terminating.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines how error messages are surfaced for distribution registration/import failures by moving WSL-specific user-facing messages to the service layer and removing generic Win32→WSL message translations from wslutil, so non-WSL callers (e.g., WSLC) don’t receive misleading WSL-specific text.
Changes:
- Emit explicit, localized user errors from
LxssUserSessionfor distro name/path conflicts during registration. - Remove several Win32 error-code special-cases from
wslutil::GetErrorString. - Add a new localized “Failed to create disk …” message for VHD creation failures and update/import tests accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/UnitTests.cpp | Updates import test expectations and adds a new path-conflict registration scenario |
| src/windows/service/exe/LxssUserSession.cpp | Throws user-facing localized errors for distro name/path conflict cases |
| src/windows/common/wslutil.cpp | Removes Win32→WSL-specific message mappings from GetErrorString |
| src/windows/common/WslCoreFilesystem.cpp | Wraps CreateVirtualDisk failures with a new user-facing localized error |
| localization/strings/en-US/Resources.resw | Adds the localized string used for disk creation failure messaging |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- ImportDistro: Remove 'Failed to create disk' wrapper since the error occurs before CreateVhd, producing only the raw system error message - ModernDistroInstall: Update to raw Win32 message for ERROR_ALREADY_EXISTS since the mapping was removed from GetErrorString and InstallDistro path doesn't use THROW_HR_WITH_USER_ERROR Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…oneblue/distro-error
…oft/WSL into user/oneblue/distro-error
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
benhillis
approved these changes
Apr 13, 2026
|
Thanks for the notification. Update received.
获取 Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
发件人: Ben Hillis ***@***.***>
发送时间: Tuesday, April 14, 2026 7:03:06 AM
收件人: microsoft/WSL ***@***.***>
抄送: Subscribed ***@***.***>
主题: Re: [microsoft/WSL] Don't return catch-all error messages for non-WSL specific error codes (PR #40163)
@benhillis approved this pull request.
―
Reply to this email directly, view it on GitHub<#40163 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/B677FUNMIDLJ27KVZPO6HG34VVW2VAVCNFSM6AAAAACXURXGU2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHM2DCMBSGQZTGNJUGU>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
benhillis
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
This change updates LxssUserSession to explicitly return error messages when hitting user errors on distribution registration and removes the catch-all logic in wslutil.
This will prevent WSL-specific errors from being displayed in WSLC
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed