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

Improve portability of SystemError #10726

Merged

Conversation

straight-shoota
Copy link
Member

Resolves #10720

This PR builts upon #10725 which needs to be merged first. The first two commits belong to that.
I'm posting them independently to clearly separate the two stages and keep the discussion focused.

SystemError gets a more portable API, which now consists of these main methods:

  • .from_os_error(message : String?, os_error = Errno | WinError | Nil, **opts) replaces the platform-specific .from_errno and .from_winerror methods receiving Errno and WinError values, respectively.
  • .from_errno(message : String, **opts) continues the purpose of constructing an instance with the current LibC errno value. It delegates to from_os_error(message, Errno.value, **opts).
  • .from_winerror(message : String, **opts) continues the purpose of constructing an instance with the current LibC winerror value. It delegates to from_os_error(message, WinError.value, **opts).

@straight-shoota straight-shoota requested a review from waj May 19, 2021 18:49
@straight-shoota straight-shoota changed the title Make WinError portable and improve portability of SystemError Improve portability of SystemError May 19, 2021
@straight-shoota straight-shoota force-pushed the refactor/system-error branch from 4583305 to 929f32a Compare May 21, 2021 10:59
@straight-shoota straight-shoota marked this pull request as ready for review May 21, 2021 11:00
@straight-shoota
Copy link
Member Author

Rebased on top of #10725 and ready for review.

@straight-shoota straight-shoota mentioned this pull request May 26, 2021
3 tasks
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.

Thanks @straight-shoota for this!

@beta-ziliani
Copy link
Member

Mmm... why so many reds in the CI?

@straight-shoota
Copy link
Member Author

'cause I gsubbed once too many 😆

@beta-ziliani
Copy link
Member

once it's all green again, this is good to go in my opinion

@straight-shoota straight-shoota added this to the 1.1.0 milestone May 26, 2021
@straight-shoota straight-shoota merged commit a47491f into crystal-lang:master May 29, 2021
@straight-shoota straight-shoota deleted the refactor/system-error branch May 29, 2021 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve portability of system errors
2 participants