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

Unwrap crossterm::Result<T, ErrorKind> to std::io::Result. #765

Merged
merged 12 commits into from
Apr 7, 2023

Conversation

gibbz00
Copy link
Contributor

@gibbz00 gibbz00 commented Mar 18, 2023

Introducing superficially wrapped Error types increases in most cases error handling complexity, both internally and externally.

https://github.com/fdehau/tui-rs/blob/fafad6c96109610825aad89c4bba5253e01101ed/src/backend/crossterm.rs#L125-L127

Generally, it becomes a nuisance every time one is working inside a function that returns a Result<T, io::Error>. Any expression that returns a crossterm::Result leads to a mismatched type compile time error, even if the errors are practically the same.

Unwrapping the type should also increase the transparency of the error origin.

@gibbz00 gibbz00 requested a review from TimonPost as a code owner March 18, 2023 02:13
Copy link
Member

@TimonPost TimonPost left a comment

Choose a reason for hiding this comment

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

Agree in the past we had some custom errors but as crossterm is close to io operations it should likely reflect that.

@TimonPost
Copy link
Member

TimonPost commented Apr 7, 2023

The code is not compiling

@TimonPost TimonPost merged commit a2c9350 into crossterm-rs:master Apr 7, 2023
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