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

ParseColorError is not public #1085

Closed
orhun opened this issue May 4, 2024 · 0 comments · Fixed by #1086
Closed

ParseColorError is not public #1085

orhun opened this issue May 4, 2024 · 0 comments · Fixed by #1086
Labels
bug Something isn't working

Comments

@orhun
Copy link
Sponsor Member

orhun commented May 4, 2024

Description

I have a custom error implementation via thiserror in my project. I would like to have an error variant that corresponds to ParseColorError in Ratatui, but I am unable to use that type since it is private.

To Reproduce

use ratatui::style::Color;
use std::str::FromStr;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum AppError {
    /// Error that may occur while parsing colors.
    #[error("Parse color error: `{0:?}`")]
    ParseColor(ratatui::style::color::ParseColorError),
}

fn main() -> Result<(), AppError> {
    let color = Color::from_str("#000000")?;

    Ok(())
}
9  |     ParseColor(ratatui::style::color::ParseColorError),
   |                                ^^^^^  --------------- struct `ParseColorError` is not publicly re-exported
   |                                |
   |                                private module

Proposal

Make ParseColorError public, either via exposing it from ratatui::style::color::ParseColorError or ratatui::style::ParseColorError. I think latter makes more sense since color module is private.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant