KEMBAR78
Allow conversion from ColoredString to Error by spenserblack · Pull Request #86 · colored-rs/colored · GitHub
Skip to content

Conversation

@spenserblack
Copy link
Collaborator

@spenserblack spenserblack commented Aug 26, 2020

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).

@hwittenborn hwittenborn force-pushed the master branch 3 times, most recently from 744b5dd to 1921f20 Compare July 3, 2023 11:42
Copy link
Collaborator

@kurtlawrence kurtlawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need minor version bump

@kurtlawrence kurtlawrence added bump-minor New non-breaking features needs-changelog Will need a changelog entry when merged in labels Dec 10, 2023
@kurtlawrence kurtlawrence merged commit 884232e into colored-rs:master Dec 10, 2023
@spenserblack spenserblack deleted the feature/impl-error branch December 10, 2023 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump-minor New non-breaking features needs-changelog Will need a changelog entry when merged in

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants