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

Allow conversion from ColoredString to Error #86

Merged
merged 1 commit into from
Dec 10, 2023

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.

3 participants