net-ssh / net-sftp

Pure Ruby implementation of an SFTP (protocols 1-6) client.
http://net-ssh.github.io/
MIT License
287 stars 131 forks source link

Improve Net::SFTP::StatusException Exception Information #156

Open sshaw opened 1 month ago

sshaw commented 1 month ago

Currently when a Net::SFTP::StatusException is raised we often get a #message like this:

open /some/path (4, "failure")

Not too informative.

When SFTP is run with logging at :verbose => :debug we see this helpful bit of infrormation:

 net.sftp.session[39ab0c]: SFTP User Exit Error: Bad Filename. SOME HELPFUL INFO"

How to get this information into the Net::SFTP::StatusException? I had a slightly-more-than-cursory look, and it does not look straightforward, but: looks can be deceiving.

sshaw commented 1 month ago

open /some/path (4, "failure") Not too informative.

And status code 4 is "generic failure"