colored
colored copied to clipboard
Allow conversion from ColoredString to Error
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).