jsch
jsch copied to clipboard
Throw specific exceptions at least for connect and authentication
JSch always throws the same checked exception for any errors. In some cases that is fine, but in others it is a pain. Specifically, when connecting to a host, it would be nice to know if the connection fails because the host does not exist or is down or if a TCP connection was established and something went wrong in a later stage. It would also be very useful to know if the connection failed due to an invalid user or password, as the application should typically not retry (again - the library itself retries authentications) as that can lock the account.
Gradually converting the code to throw sub-classes of the existing exception with known meanings would be a great improvement.