-
Notifications
You must be signed in to change notification settings - Fork 2
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
Error handling: error sources / kinds #9
Comments
Advised handling of errors (mostly copied from material linked above)Problems opening
|
Generalising from the above, we have the following kinds of error:
Not included in the above list:
|
One problem I now have with an And as discussed before, it just doesn't seem that useful. It is only relevant in situations that match all these points:
So normally it makes sense to just retry on interrupt. What if an RNG really has a reason the forward an interrupt? If we were to include a cause, maybe it is just enough to return |
An
Completely agree. For me it only makes sense for something that is not pseudo-random, but 'really' random. And that normally seems to be only deep in the OS implementation of its RNG, not available to us. Maybe some RNG that exposes With all the disagreement about reseeding and entropy we could just expose the error kind and not think to hard about it. Or combine it with 'Insufficient entropy', which is pretty close... |
Okay, good points about But if I don't like the name 'insufficient entropy' because it's not clear what the user should do about it. 'Wait' is better IMO (and other error kinds where different handling is expected). |
It seems to be possible to sort-of reseed
This is true for Also "wait" feels more like a prescription than an error to me. |
Yes, you can write to
|
Writing to
Still I don't like the name |
As far as the names are concerned, I don't like |
While writing the PR I did have a look at the names in std::io::ErrorKind, and the names used in other libraries. It seemed like a good idea to follow them, and they mostly describe the cause of the error, not how it should be handled. I have no problem with Instead of
|
Or
|
It costs us nothing to include it, and I can see it be useful sometimes. |
It seems like a smart thing to do. We now think we have all error kinds pretty much covered. But it is common, and good advice to prevent breaking changes. |
I decided not to allow exclusive match for now. I don't see much benefit, and it can be done in the future without breakage anyway. |
This has been implemented and revised so I think this issue can be closed now. |
Possible errors (detectable during initialisation, i.e. only applicable to
new()
methods):/dev/urandom
)Possible errors (at any time, thus affecting
new()
,next_*
andtry_fill()
):Proposed error kinds:
References:
The text was updated successfully, but these errors were encountered: