Exceptions in Rebex components:
Standard exceptions are raised when appropriate:
- ArgumentException (bad argument provided)
- InvalidOperationException (you called a method when you shouldn't)
- ObjectDisposedException (the client object is disposed)
In other situations, Rebex component-dependent exceptions are raised instead:
Rebex SFTP:
- SftpException for SFTP
Rebex FTP/SSL:
- FtpException for FTP
- TlsException for FTP/SSL
Rebex Secure Mail:
- ImapException for IMAP
- Pop3Exception for POP3
- SmtpException for SMTP
and others for other components (TerminalException, SshException, TelnetException, WebSocketException ...)
These exceptions usually feature Status property that makes it possible to determine the error category. For example, status of ProtocolError indicates server-side errors, and in this case, there is usually another property you can check for more protocol-dependent information, such as:
- SftpException.Code in Rebex SFTP
- FtpException.Response in Rebex FTP
- ImapException.Response in Rebex IMAP
All the protocol-dependent exceptions inherit from NetworkSessionException, which might be convenient when working with multiple different Rebex classes.