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

Use snafu to derive errors #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fjarri
Copy link
Contributor

@fjarri fjarri commented Jan 16, 2023

Removes the need of making separate Display impls for errors. Would be nice to use thiserror instead, but it doesn't support no-std.

Problems:

  • It doesn't support enum variants with anonymous fields. The source error field must be named source and thus have a docstring. Annoying.
  • Some errors cannot be wrapped (e.g. sec1::Error, which is returned by EncodedPoint::from_bytes()) because of trait bounds not satisfied.
  • The strange "context" thing that it does where #[derive(Snafu)] enum MyError { Something } implicitly adds SomethingSnafu to the namespace, which is supposed to be used with the ResultExt trait.

So I don't know. Would be nice to remove some boilerplate, but I don't love this crate. Leaving the PR in the suspended state for now.

@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2023

Codecov Report

Merging #113 (ffa12dc) into master (50a7a6e) will increase coverage by 1.34%.
The diff coverage is 0.00%.

❗ Current head ffa12dc differs from pull request most recent head 0763d32. Consider uploading reports for the commit 0763d32 to get more accurate results

@@            Coverage Diff             @@
##           master     #113      +/-   ##
==========================================
+ Coverage   47.49%   48.83%   +1.34%     
==========================================
  Files          17       17              
  Lines        1017      989      -28     
==========================================
  Hits          483      483              
+ Misses        534      506      -28     
Impacted Files Coverage Δ
umbral-pre/src/capsule.rs 94.93% <ø> (+6.70%) ⬆️
umbral-pre/src/capsule_frag.rs 85.00% <ø> (+5.31%) ⬆️
umbral-pre/src/dem.rs 93.54% <ø> (+15.17%) ⬆️
umbral-pre/src/key_frag.rs 90.80% <ø> (+5.85%) ⬆️
umbral-pre/src/pre.rs 96.66% <0.00%> (+11.37%) ⬆️
umbral-pre/src/traits.rs 0.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants