nick42d / youtui

TUI and API for YouTube Music written in Rust
MIT License
30 stars 2 forks source link

Should Error type be public? #32

Closed pianocomposer321 closed 3 weeks ago

pianocomposer321 commented 1 month ago

Hello, thanks for your work on this!

I ran in to an issue when using it though. Many of the api functions return a Result where the Err variant is of type ytmapi_rs::error:Error, which is private. This means that I can't match on the error type and react differently depending on what produced the error. Should this module be public?

nick42d commented 1 month ago

Hi there, ytmapi_rs::error::Error should be re-exported as ytmapi_rs::Error for convenience, and then to get the kind for pattern matching you would call into_kind() to get the ErrorKind (similar to std::io::Error). However seems I haven't made ErrorKind public. Happy to accept a PR, otherwise I am hoping to have some time to work in this crate in a week or 2's time. Development note: ErrorKind should be marked #[non_exhaustive] to allow for future error kind's to be added without a breaking change (https://doc.rust-lang.org/src/std/io/error.rs.html#190).

nick42d commented 3 weeks ago

@pianocomposer321 resolved on main, keep an eye out for ytmapi_rs 0.0.3 on crates.io soon.

nick42d commented 3 weeks ago

@pianocomposer321 v0.0.3 now on cargo