google / coset

A set of Rust types for supporting COSE
Apache License 2.0
28 stars 16 forks source link

CoseError doesn't seem to implement std::error::Error. #70

Closed d3zd3z closed 1 year ago

d3zd3z commented 1 year ago

The CoseError doesn't seem to implement the standard Error trait, and it makes this error hard to manage when building other types of errors with other tools, such as thiserror, or anyhow. Even a simple impl line for this should be sufficient:

impl std::error::Error for CoseError{}

but this has to be done inside of the coset crate.

daviddrysdale commented 1 year ago

Try enabling the std feature:

https://github.com/google/coset/blob/main/src/common/mod.rs#L90-L91

daviddrysdale commented 1 year ago

(Reopening as a reminder to update the README to mention the std feature)

d3zd3z commented 1 year ago

Another option would be to make std the default, and could be explicitly disabled when needed. This seems to be how most crates handle this.

daviddrysdale commented 1 year ago

Making std the default would be a breaking change and necessitate a major version bump, so non-default was better. Hopefully core::error::Error will stabilise and we can drop the need for the feature in future.

README updated, so closing.