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

Change stack from failure to std::error::Error #101

Closed
bltavares opened this issue Feb 24, 2020 · 2 comments
Closed

Change stack from failure to std::error::Error #101

bltavares opened this issue Feb 24, 2020 · 2 comments

Comments

@bltavares
Copy link
Member

Feature Request

Summary

Nowadays hypercore is defined for storage where errors are failure::Error eg

This predates when Rust had std::error::Error trait, and could now be replaced with a Error + Send + Sync + 'static, such as anyhow, snafu or coreerror for a no_std crate.

This is also one less crate on the stack.

Motivation

This should help us move into no_std in the future, specially useful for WASM and embedded.

Guide-level explanation

We could replace failure with anyhow on random-access-disk and random-access-storage to use context during errors, which is also compatible with std::error::Error.

We can then define hypercore using the std Error trait, and broaden the types of Storages hypercore can use.

Reference-level explanation

Drawbacks

Rationale and alternatives

Unresolved Questions

bltavares added a commit to bltavares/hypercore that referenced this issue Feb 26, 2020
bltavares added a commit to bltavares/random-access-disk that referenced this issue Feb 26, 2020
bltavares added a commit to bltavares/random-access-memory that referenced this issue Feb 26, 2020
@bltavares bltavares changed the title [Pre-RFC] Change stack from failure to std::error::Error Change stack from failure to std::error::Error Feb 26, 2020
@bltavares
Copy link
Member Author

PRs with moves opened and linked to the issue.

bltavares added a commit to bltavares/hypercore that referenced this issue Feb 26, 2020
bltavares added a commit to bltavares/hypercore that referenced this issue Feb 26, 2020
bltavares added a commit to bltavares/hypercore that referenced this issue Feb 26, 2020
yoshuawuyts pushed a commit to datrs/random-access-memory that referenced this issue Mar 2, 2020
bltavares added a commit to datrs/random-access-disk that referenced this issue Mar 3, 2020
* Update changelog

* Move from failure to use stderr

Related to datrs/hypercore#101
bltavares added a commit to bltavares/hypercore that referenced this issue Mar 3, 2020
bltavares added a commit to bltavares/hypercore that referenced this issue Mar 3, 2020
@bltavares
Copy link
Member Author

Landed on the beta versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant