Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Use a custom Fail type instead of format_err! #8

Open
csssuf opened this issue Feb 8, 2018 · 1 comment
Open

Use a custom Fail type instead of format_err! #8

csssuf opened this issue Feb 8, 2018 · 1 comment

Comments

@csssuf
Copy link
Contributor

csssuf commented Feb 8, 2018

format_err! and string-based errors are good for this initial prototype, but aren't a great long-term solution for a library API. Instead, some type should implement Fail, and the library should use errors of this type. Since ReturnCode already exists and corresponds to the different error codes returned from libyubihsm, it would be a good candidate for implementing Fail.

@tarcieri
Copy link
Contributor

tarcieri commented Feb 8, 2018

As I noted on another issue, what failure enables which is pretty nice is having several different error types in a single crate, all of which compose as failure::Error in Result types.

For this crate, you probably want a ConnectorError and a SessionError type

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants