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

Implement std::fmt::Display, std::error::Error for errors #44

Closed
yerke opened this issue Feb 3, 2019 · 4 comments
Closed

Implement std::fmt::Display, std::error::Error for errors #44

yerke opened this issue Feb 3, 2019 · 4 comments

Comments

@yerke
Copy link

yerke commented Feb 3, 2019

Hi. Thank you for your work on this crate.

Is it possible to implement std::fmt::Display, std::error::Error traits for errors, such as block_modes::BlockModeError, block_modes::InvalidKeyIvLength?
This way it will be straightforward for users to do impl From<BlockModeError> for MyLocalError as described in https://doc.rust-lang.org/stable/rust-by-example/error/multiple_error_types/wrap_error.html.

Thanks.

@newpavlov
Copy link
Member

Those traits are already implemented, you just have to enable std feature for block-cipher-trait crate. On future minor version bump we may add enabled by default std feature to all block cipher crates which will enable block-cipher-trait/std automatically, but until then you'll have to do it manually.

@yerke
Copy link
Author

yerke commented Feb 4, 2019

I think there is some sort of confusion here. You have linked the implementation for InvalidKeyLength, not InvalidKeyIvLength or BlockModeError.

@newpavlov
Copy link
Member

Ah, you've meant errors from block-modes crate. I will add impls right away.

@yerke
Copy link
Author

yerke commented Feb 5, 2019

Thank you for such quick turnaround!

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

2 participants