-
Notifications
You must be signed in to change notification settings - Fork 76
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
Use enums instead of Box<Error> for failure #55
Comments
Also you might want to update |
I'd like this feature too. @fschutt, could you make a PR from this? |
@fschutt I'm willing to merge this (and it looks like your |
Well, when I made the fork I basically squashed the entire history and rewrote a lot of things. Not sure how to rebase all of this without losing the history. I'm not against merging it of course, but I don't see how I could undo this without losing all of the history. @aweinstock314 I've never used cherry-picking, maybe you're better at git, so that may be an option. I'm fairly busy atm, feel free to merge my fork back in. It's just that you didn't respond for several months, so I thought this repo isn't maintained anymore, hence the fork. |
It looks like the squash of the history also squashed your changes to error-handling into the initial commit of clipboard2, so there is no history to preserve. I'll adapt your error-handling code in as one commit, and the format handling in another. |
Thanks for working on this! I think the issue is solved in |
It does not look like it's fixed in master. |
When I used in async function, it fails by: error: future cannot be sent between threads safely
help: the trait `std::marker::Send` is not implemented for `dyn std::error::Error` enum type can fix this |
I've hard-forked this repository at https://github.com/fschutt/clipboard2 and changed it to return a
ClipboardError
enum. The problem withBox<Error>
is basically that it erases all type information - the library user can only get the description, which isn't of much use except for debugging.I've replaced all usage of
Box<Error>
with an error enum which is not only type-safe and more descriptive (the library use now knows why the function could fail), but also more performant (no dynamic dispatch). I'd be happy to contribute the changes back into this repo, but for now I'm using the hard fork (I'll credit your repository though, since large amounts of that repo isn't technically my code).The text was updated successfully, but these errors were encountered: