Add custom error type for OpenSSL bindings #49
Merged
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.
This PR adds
KeylimeCryptoError
, a custom error type, to be used by all bindings incrypto.rs
. This allows a uniform return type that handles a variety of different errors thrown by implementations of the crypto wrappers, without complex logic or loss of error information. More information can be found at the corresponding issue, #42.Notes:
KeylimeCryptoError
is not included as a return type for existing functions at the moment. I intend to update the existing bindings with the new error type in a separate PR.Currently,
KeylimeCryptoError
preserves OpenSSLErrorStack
structs in their entirety by simply wrapping them. This allows further reference down the line if needed, though suggestions are welcome for simplification.Right now,
KeylimeCryptoError
can handlestd::io::Error
andopenssl::error::ErrorStack
types; those two are the only ones thatcrypto.rs
requires at the moment. Should new crypto bindings require additional error handling, these can be expanded accordingly.Tagging @frozencemetery, @leonjia0112, @lukehinds for review.