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

Trait implementations and error handling #51

Merged
merged 8 commits into from
Jun 13, 2021

Conversation

fjarri
Copy link
Contributor

@fjarri fjarri commented Jun 7, 2021

Based on top of #50

  • Move HasName trait from Python bindings into the main library and rename it to HasTypeName
  • Add a Display implementation for public types in the main library and use it in Python/WASM bindings (was formerly only implemented in Python bindings)
  • Remove GenericError from Python bindings; in the cases where it is used it can be replaced by ValueError
  • from_array() can only return a ConstructionError now, and not a size mismatch error (because the array size is already statically asserted by the compiler)
  • Add toBytes()/fromBytes()/toString() methods to public objects in WASM bindings. Fixes Expose serialization in bindings #11 (if we decide to use some third-party serialization, like protobuf, it should be made a separate issue)
  • Merge DeserializationError::TooManyBytes/TooFewBytes into a single SizeMismatch
  • Retain more information in deserialization errors: the error message and the problem type for construction errors (helps when deserializing structures with nested elements), the expected/received bytestring size for size mismatch
  • Raise exceptions properly instead of using unwrap() in WASM bindings. Fixes Propagate errors without panics when possible in WASM bindings #14, fixes Only enable console_error_panic_hook in tests #16 (console_error_panic_hook is not needed anymore since there are no panics)
  • Move error messages from Python bindings into Display implementations of error types in the main library, and use them from Python/WASM bindings to form exceptions
  • Expose SecretKeyFactory in WASM bindings
  • Use camel case for method names in WASM bindings

@fjarri fjarri added WASM Related to WASM bindings Python Related to Python bindings API Related to public API labels Jun 7, 2021
@fjarri fjarri force-pushed the trait-implementations branch from 2119da4 to 106eccc Compare June 7, 2021 05:27
@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2021

Codecov Report

Merging #51 (1b57bdd) into master (8a7f9c7) will decrease coverage by 10.51%.
The diff coverage is 25.36%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #51       +/-   ##
===========================================
- Coverage   94.28%   83.77%   -10.52%     
===========================================
  Files          11       11               
  Lines         805      912      +107     
===========================================
+ Hits          759      764        +5     
- Misses         46      148      +102     
Impacted Files Coverage Δ
umbral-pre/src/dem.rs 77.08% <0.00%> (-15.42%) ⬇️
umbral-pre/src/pre.rs 93.33% <0.00%> (-6.67%) ⬇️
umbral-pre/src/capsule.rs 88.98% <7.69%> (-10.09%) ⬇️
umbral-pre/src/capsule_frag.rs 86.02% <14.28%> (-8.33%) ⬇️
umbral-pre/src/keys.rs 74.16% <15.62%> (-21.71%) ⬇️
umbral-pre/src/key_frag.rs 81.05% <17.64%> (-6.45%) ⬇️
umbral-pre/src/curve.rs 83.92% <33.33%> (-10.19%) ⬇️
umbral-pre/src/traits.rs 76.13% <51.21%> (-20.42%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a7f9c7...1b57bdd. Read the comment docs.

@fjarri fjarri added this to the v0.1.0 milestone Jun 7, 2021
@fjarri fjarri force-pushed the trait-implementations branch from 677f6c2 to 1b57bdd Compare June 13, 2021 20:19
@fjarri fjarri merged commit c9c5770 into nucypher:master Jun 13, 2021
@fjarri fjarri deleted the trait-implementations branch June 13, 2021 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to public API Python Related to Python bindings WASM Related to WASM bindings
Projects
None yet
3 participants