ftp_client/error.rs
1//! Define errors that can happend by using the
2//! ftp-rs crate.
3
4use derive_error::Error;
5use native_tls::{Error as TlsError, HandshakeError};
6use std::net::TcpStream;
7
8/// A generic client error, basically anything that can go wrong with
9/// a request has a variant on this enum.
10#[derive(Debug, Error)]
11pub enum Error {
12 /// IO Error
13 IoError(std::io::Error),
14 /// Unexpected status code
15 #[error(msg_embedded, no_from, non_std)]
16 UnexpectedStatusCode(String),
17 /// A (de)serialization failed
18 #[error(msg_embedded, no_from, non_std)]
19 SerializationFailed(String),
20 /// Invalid socket IP from passive mode
21 #[error(msg_embedded, no_from, non_std)]
22 InvalidSocketPassiveMode(String),
23 /// Error on TLS handshake
24 TlsHandshakeError(HandshakeError<TcpStream>),
25 /// Error while creating TLS connector
26 TlsError(TlsError),
27}