Skip to content

fix: incorrect Winsock error messages by using FormatMessage - #9337

Closed
claytonlin1110 wants to merge 1 commit into
deskflow:masterfrom
claytonlin1110:fix/winsock-error-messages
Closed

fix: incorrect Winsock error messages by using FormatMessage#9337
claytonlin1110 wants to merge 1 commit into
deskflow:masterfrom
claytonlin1110:fix/winsock-error-messages

Conversation

@claytonlin1110

Copy link
Copy Markdown

Description

Fixes incorrect error messages for Winsock errors, particularly WSAEACCES (10013), by replacing the hardcoded error message list with FormatMessage - the Microsoft-recommended approach.

Problem

The winsockErrorToQString() function used a hardcoded list of error messages that always returned the same message for each error code, regardless of the actual cause. For example, WSAEACCES (10013) always returned "The requested address is a broadcast address, but the appropriate flag was not set" even when the real issue was firewall blocking or other access-related problems.

This led to confusing error messages that didn't reflect the actual error cause, making troubleshooting difficult for users.

Solution

Replaced the hardcoded implementation with a call to windowsErrorToQString(), which uses Windows' FormatMessage API to retrieve accurate, localized error messages from the system.

Testing

  • Verified that FormatMessage correctly handles Winsock error codes
  • Confirmed backward compatibility (all existing code paths continue to work)
  • No linter errors

Fixes #9067

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=118192227

@claytonlin1110
claytonlin1110 requested a review from a team January 14, 2026 16:02
@claytonlin1110

Copy link
Copy Markdown
Author

@sithlord48 Please review

@sithlord48 sithlord48 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm sure ...
@nbolton You can land after you review it

@nbolton

nbolton commented Jan 15, 2026

Copy link
Copy Markdown
Member

Umm sure ... @nbolton You can land after you review it

I'll try to repro one of the messages to prove it works.

@claytonlin1110

Copy link
Copy Markdown
Author

Umm sure ... @nbolton You can land after you review it

I'll try to repro one of the messages to prove it works.

@nbolton Had a chance to repro issue?

@sithlord48

Copy link
Copy Markdown
Member

#9361

@claytonlin1110

Copy link
Copy Markdown
Author

@nbolton Please review this

@sithlord48

Copy link
Copy Markdown
Member

do not @ ppl for revew we are aware this needs review and it will get reviewed in time. If you have added changes and would like new review then up in the reviewer section hit the refresh button near the stale reviews name

@nbolton

nbolton commented Jan 22, 2026

Copy link
Copy Markdown
Member

This is actually quite badly done; it's low effort, probably untested and leaves redundant functions.

Closing AI slop.

@claytonlin1110

Copy link
Copy Markdown
Author

@nbolton Would you please re-review this? not an AI slop...

@sithlord48

Copy link
Copy Markdown
Member

Something similar has been done by #9384

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom messages for Winsock error codes are sometimes wrong

3 participants