-
Notifications
You must be signed in to change notification settings - Fork 160
Move from error-chain to thiserror
#394
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
Closed
pwoolcoc
wants to merge
13
commits into
killercup:master
from
pwoolcoc:issue-344-switch-to-thiserror
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9aa7e86
Move cargo-edit lib to thiserror
09e3b4f
Use `thiserror` for cargo-add
3e2a6d9
use `thiserror` for cargo-rm
2a8e63c
use `thiserror` for cargo-upgrade
650f4f7
Remove leading `::` from import paths
ddebe9d
change these loops to while-lets
c1acd7c
Add `anyhow` to crate lib
373bbb6
Add `anyhow` to cargo-add
d18e7a6
Add `anyhow` to cargo-rm
4f04abe
Add `anyhow` to cargo-upgrade
87290d8
rustfmt pass
b503e36
Remove `anyhow` from the library
2760f26
Reduce the number of possible errors
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it not possible to keep backtraces with anyhow? :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anyhow can display backtraces as long as it was complied by nightly, since the stdlib
backtracefeature is still unstable. I've tried to convincefailure::Fail::backtraceto accept ananyhow::Errorand try to get a backtrace out of it, but haven't had any luck.anyhow::Errorwill deref to adyn Error + Send + Sync + 'static, butFail::backtracecomplains that it is unsized.I've added a feature that will allow a user to compile with backtrace support as long as they are on nightly, but if there is a better way I'd be more than happy to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@killercup are backtraces used for identifying bugs in cargo-edit if it fails to run on some input? maybe it's not that helpful for the users after all
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have sworn that anyhow brought in a dependency on
backtrace-rson stable but apparently not. I don't mean to shamelessly plug my own stuff but if you want stable backtraces you can swap fromanyhowtoeyrewhich is a fork that adds support for custom context types, which you could define to include abacktrace::BacktraceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Losing backtraces is kind of a shame from a technical standpoint, but I don't think they are being relied on by anyone using cargo-edit, because we have such amazing error descriptions! 😉
Kidding aside, I think this is fine. When we finally end up packaging binaries we can compile them with nightly and get some backtraces for free.
@yaahc, I just got what the name is about. Amazing. I'm also totally fine with using your fork. Or switching to it in a later PR.