-
Notifications
You must be signed in to change notification settings - Fork 166
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
try_from_* methods should either return an error-containing Result or an Option #73
Comments
It seems like these functions should have an error type like
|
Note that in this crate and in ring we avoid most error infrastructure. In particular, we avoid implementing |
These choices and explanations are perfectly reasonable. Too bad Introducing |
I would take a PR that does this. |
I followed the idea you expressed, let me know what you think. |
Considering the following
DNSNameRef
signaturesFrom an API standpoint, I think returning a
Result
that has()
for an error type is not good design.If multiple libraries adopt this pattern, it is not possible to differentiate between the
()
from lib A and()
from lib B. Which forces any error to bemap_err()
/ handled immediately by the calling code when most often a simple?
would be preferable. It would otherwise be preposterous to force applications to assume that any()
error result originates only fromwebpki
, or to require that any error of type()
be considered of unknown origin.If a Result<> has no error context to provide, an error-less Option<> should be returned instead.
The text was updated successfully, but these errors were encountered: