-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Relax the error type in handle #21
Conversation
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
Without this change the client informs about error in communication: ``` $ ssh-add -s test Enter passphrase for PKCS#11: Could not add card "test": communication with agent failed ``` After this change the error informs about agent refusing the operation: ``` $ ssh-add -s test Enter passphrase for PKCS#11: Could not add card "test": agent refused operation ``` Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
9632941
to
c08cb6b
Compare
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
358aa9b
to
022a4ef
Compare
@baloo If you'd like to take a look at this I'd much appreciate. I've made this PR after working a bit with a downstream crate that uses it and the annoying fact that everything need to be mapped to I've also made it return |
That is a problem with the downstream crate that should have an error like:
|
I think it's quite unlikely that they will ever want to convert from AgentError since if AgentError is raised in the The only reason where the client can get a AgentError is via |
Wait, I thought this through. The Proto/IO variants can't happen here
since this is `handle` function that returns from the client's code.
That is: the Proto/IO can only happen if *the client* constructs that
variant (which, I think, is outside of what you've been thinking of).
Thinking about it for a bit longer the `User` variant was always a bit
weird: it's from a client code but it doesn't have any details of what
happened. I'm wondering if it should just be removed altogether.
Or maybe you're thinking that the client code will do some parsing of
SSH structures "on demand" and then return an AgentError::Proto?
Phew :)
|
Oh yeah, you're right. But we can remove the |
Yup. Heh, this along with your RustCrypto PR will make the crate quite a
bit leaner :)
|
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
b91f2fc
to
678d32c
Compare
This allows clients to directly use
?
with their error types instead of mapping everything toAgentError
which obscures the error reason.