We use FTP/SFTP with a number of different servers but one on a regular basis causes a lot of issues. At times during the script, we get "550 java.net.SocketException: Connection reset by peer: socket write error" but the script continues one and we then get "java.net.SocketException: Connection reset by peer: socket write error" and then authentication type errors because the connection is closed.
I know I can pick these issues up at the end while parsing the log file but by then the script could have tried multiple file/foder operation on local and remote systems.
Basically, can we define some codes or codes and text that will abort a script?
What codes should abort a script?