feat for issue #809: impl std::error::Error for cursive::theme::Error#849
Merged
gyscos merged 1 commit intogyscos:mainfrom Nov 27, 2025
Merged
Conversation
…:Error gyscos#809 had been opened inquiring about implementing `std::error::Error` for `cursive::theme::Error` so they could do something like this: ``` fn load_theme(siv: &mut CursiveRunnable, path: PathBuf) -> anyhow::Result<()> { siv.load_theme_file(path)?; Ok(()) } ``` Instead of having to do this: ``` 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()), } } } ``` It seemed like low hanging fruit, so I figured I'd offer up a PR. Included some tests for the different `Error::Io`, `Error::Parse` and `?` cases. Thank you for considering this change!
Contributor
Author
|
cc @septante |
|
I ended up switching to ratatui because I needed support for rendering images, but this looks like what I was asking for. Thank you! |
Contributor
Author
|
Ahh nice @septante! And you're welcome! Better late than never, haha! |
Owner
|
Thanks for the PR! |
Contributor
Author
|
@gyscos Of course! I'll try to look through the Issues list and see if I can grab a few more of them over the next few weeks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#809 had been opened inquiring about implementing
std::error::Errorforcursive::theme::Errorso they could do something like this:Instead of having to do this:
It seemed like low hanging fruit, so I figured I'd offer up a PR. Included some tests for the different
Error::Io,Error::Parseand?cases.Thank you for considering this change!