You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hm, digging deeper into this I recognize that the error which showed up for the top-level code is not created in RequestSubsystem, the error string is slightly different: subsystem request failed on channel 0 vs ssh: subsystem request failed
Since I can't find the string anywhere in the Go code, I suspect that the error is printed by my ssh client program. I therefore close this issue, because this has nothing to do with the sftp package.
I'm sorry for everybody who read my journey here ;)
Solution to this issue: The error message is indeed printed by the ssh program I started. The error is printed for server which do not offer the sftp subsystem. Mystery solved.
Hi,
I'm writing a backup program (restic) which uses the sftp library. Recently, a user reported an issue with using his NAS with restic over sftp.
It turned out that sftp was deactivated for the NAS, but restic only printed a generic error message:
I'd like to be able to catch this error and replace it with a more meaningful message for my users.
Unfortunately, the original error (from ssh/session) is created like this:
and the sftp library just passes it up the stack (here:
So in order to distinguish this error from others, the only way is to match against the string. That's ugly.
Would you accept a PR which returns a custom wrapper error type when
RequestSubsystem
returns an error? Something along the lines:Then the caller can test the behavior of the error by checking if it implements the method
SubsystemRequestFailed()
.Does that sound good? Any better idea for the method name?
The text was updated successfully, but these errors were encountered: