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
Net::Http.get_response().code.

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

Any idea?

//Walle