-
Notifications
You must be signed in to change notification settings - Fork 136
Revise errors for CertificateSigningRequestParams::from_der #388
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
base: main
Are you sure you want to change the base?
Revise errors for CertificateSigningRequestParams::from_der #388
Conversation
334716a
to
0c9946e
Compare
It would be nice to better understand the motivation/use case here. |
@djc, I’m assuming the original introduction of Lines 651 to 656 in 453bcb5
where a catch-all error case of the underlying crypto library is lifted into the And later it was re-used in this case It would be clearer in code that uses this library to have error variant names that map in a self-evident way to the expected error conditions expected in parsing and verifying a CSR. Some, but not all, existing error variants include contextual hints in the name ( |
- Introduce specific error for CSR signature verification - Make error name more specific for unsupported CSR extensions
0c9946e
to
5fd069c
Compare
You still haven't really answered this question. What problem did you run into that you are trying to solve? |
match CertificateSigningRequestParams::from_der(csr_der) {
Ok(csr_params) => …,
Err(rcgen::Error::RingUnspecified) => …,
Err(rcgen::Error::UnsupportedExtension) => …,
Err(_) => …,
}
|
Submitted an alternative in #390. |
It sounds like you agree on 1? Do you also agree on 2? Are you open to a more specific name for the rejection of an extension in a CSR? |
I'm on the fence because I think the documentation for the variant and error string ( |
Certainly those parts are, but that doesn’t immediately help clarity in source code. match something_that_interally_calls_from_der(…) {
Ok(…) => …,
Err(rcgen::Error::UnsupportedExtension) => …,
Err(_) => …,
} My contention, from above, is that if the error handling for The current recourse is to add comments asking the reader to jump to documentation on the error value or the |
I don't feel strongly but agree that duplicating the error types under a new name + deprecating the old ones doesn't feel like it's worthwhile in this case. Maybe better to file an issue tagged with a label to just outright fix the name in the next semver breaking release. |
Following up from