Skip to content

impl std::error::Error for cursive::theme::Error #809

@septante

Description

@septante

Is there a reason that cursive::theme::Error doesn't implement the standard Error trait? I would like to write

fn load_theme(siv: &mut CursiveRunnable, path: PathBuf) -> anyhow::Result<()> {
    siv.load_theme_file(path)?;
    Ok(())
}

However, currently one has to write the following:

fn load_theme(siv: &mut CursiveRunnable, path: PathBuf) -> anyhow::Result<()> {
    match siv.load_theme_file(path) {
        Ok(_) => Ok(()),
        Err(e) => match e {
            cursive::theme::Error::Io(e) => Err(e.into()),
            cursive::theme::Error::Parse(e) => Err(e.into()),
        }
    }
}

I would be happy to open a PR for this if needed. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions