-
Notifications
You must be signed in to change notification settings - Fork 134
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
der: Document (or improve) der::Decode
trait impl error handling
#1492
Comments
The If |
@str4d was this issue primarily motivated by iqlusioninc/yubikey.rs#580 or something else? The That's a new addition which may not be properly reflected in the documentation yet. |
Regarding speculative decoding and computing the exact position for that, you can use the peek functionality to look ahead without actually modifying the cursor in the buffer, if that's helpful. Otherwise, |
As part of #1491, I needed to implement decoding for the custom extension I wrote for #1490. I encounted several problems:
der::Decode::decode
returnsder::Result
, and AFAICT there is no way to return a type-specific error code inder::Error
. None of the existingder::ErrorKind
s appear to be usable for this (or at least, I cannot figure out whether returning one of them will cause unexpected side-effects).der::Error
was confusing, until I stumbled uponder::Reader::error
. Theder::Decode
trait (as well asder::Error
) should document that errors should be created usingdecoder.error()
(or whatever new method is added for defining user errors). It is also unclear to me whether the position that this method uses will be correct, if I am doing post-read validation (in which case I think the position will be one after the actual problem position).The text was updated successfully, but these errors were encountered: