-
Notifications
You must be signed in to change notification settings - Fork 54
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
Wrapping errors that do not implement Send #51
Comments
I think this will be mostly for documentation as windows::Error will support Send and Sync soon microsoft/windows-rs#601 |
I'll do some research on how we could approach this. I'm thinking either provide an alternate constructor that wraps the errors in a If you have suggestions on which of these you'd prefer please lmk. |
Hey @yaahc thanks for the answer! #[derive(Debug)]
pub struct KeyringWrapper(Arc<Mutex<KeyringError>>);
impl StdError for KeyringWrapper {
fn source(&self) -> Option<&(dyn StdError + 'static)> {
todo!()
}
}
impl Display for KeyringWrapper {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.0.lock().unwrap().fmt(f)
}
} But I was not sure on what to put on |
The only way I can think of to do this is to return another newtype that still wraps the entire |
* Implement panic_note feature * Fix typo * Rename to panic_section and use Display impl * Update src/config.rs * Move panic_section after panic message Co-authored-by: Jane Lusby <jlusby42@gmail.com>
Hi there, first of all, thank you very much for this project. It makes working with errors in cli implementations really pleasant and fun!
I was trying to wrap an error that comes from a library I wrote that uses thiserror:
Only this should be ok but on
UnknownBackendError
, that KeyringError can contain aKeyringError(OsError)
, and on windows,OsError
iswindows::Error
.I noticed the error when I tried to use
?
on a function that useseyre::Result
and the following error showed up:And my first thought was to wrap it with eyre using the suggestions here:
so I could write:
but the following error returns:
Do you see a solution for that?
Thanks in advance!
The text was updated successfully, but these errors were encountered: