Status of sftp/ssh connection. Retrieve error-msgs

Hey, I’m trying to determent the status of a sftp and ssh connection to
a specific server. I’m currently using Net::SFTP and Net::SSH. Is there
any similar way of doing this as with the Net::Http, were I’m using

I would like to extract the server response,
“Net::SSH::AuthenticationFailed” etc without using rescue.

Any idea?