colored icon indicating copy to clipboard operation
colored copied to clipboard

Allow conversion from ColoredString to Error

Open spenserblack opened this issue 3 years ago • 0 comments

A string can be converted to a Box<dyn Error>, allowing something like

fn main() -> Result<(), Box<dyn Error>> {
    Err("ERROR")?
}

This PR also allows type conversion from ColoredString to Box<dyn Error>, so you can do

fn main() -> Result<(), Box<dyn Error>> {
    Err("ERROR".red())?
}

And get the expected styling in the error message (see added example).

spenserblack avatar Aug 26 '20 18:08 spenserblack