Skip to content
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

Add WinError.wsa_value and specs for WinError #10762

Merged

Conversation

straight-shoota
Copy link
Member

This patch adds WinError.wsa_value which returns the last error value of the Windows Socket API from WSAGetLastError.

This is a follow-up on #10726 which already references WinError.wsa_value from SystemError.from_wsa_error. Because it's not used yet (but soon!), this wasn't caught. To remedy this, I'm also adding specs for WinError.

Writing proper specs requires setting the error value, so I also added setters to WinError, for both the win32 and WSA error values. We also expose these setters on Errno, the POSIX-companion of WinError, so I think it makes sense to have them here, too.

@straight-shoota straight-shoota added kind:feature platform:windows Windows support based on the MSVC toolchain / Win32 API topic:stdlib:runtime labels May 29, 2021
Copy link
Member

@beta-ziliani beta-ziliani left a comment

Choose a reason for hiding this comment

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

Awesome!

@straight-shoota straight-shoota added this to the 1.1.0 milestone Jun 2, 2021
@straight-shoota straight-shoota merged commit 2f025a7 into crystal-lang:master Jun 4, 2021
@straight-shoota straight-shoota deleted the feature/winerror-wsa branch June 4, 2021 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feature platform:windows Windows support based on the MSVC toolchain / Win32 API topic:stdlib:runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants