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

Display winapi errors #134

Closed
wants to merge 1 commit into from
Closed

Display winapi errors #134

wants to merge 1 commit into from

Conversation

radkum
Copy link

@radkum radkum commented Jan 9, 2025

If the WinAPI connection fails, we have no information about what went wrong. The purpose of the PR is only to add WinAPI error information to the error message


This change is Reviewable

@radkum radkum marked this pull request as ready for review January 9, 2025 11:15
@faern
Copy link
Member

faern commented Jan 9, 2025

You can already obtain this information from the source() method on the error. The winapi error is one step down in the error chain. An error should not both return sub-errors in its source() method and include its error message in itself. Your PR makes the error chain redundant. If you now print the error chain it will look something like:

Error: IO error in winapi call: It went bad on the inside
Caused by: It went bad on the inside

I have been trying to get this merged as a best practice for Rust in general, but the discussion died after a while :) rust-lang/api-guidelines#210

@faern faern closed this Jan 9, 2025
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.

2 participants