1use std::io;
2use thiserror::Error as ThisError;
34pub use ssh_format_error::Error as SshFormatError;
56#[derive(Debug, ThisError)]
7#[non_exhaustive]
8pub enum Error {
9/// Server speaks multiplex protocol other than protocol 4.
10#[error("Server speaks multiplex protocol other than protocol 4.")]
11UnsupportedMuxProtocol,
1213/// Server response with unexpected package type {0}: Response {1:#?}.
14#[error("Server response with unexpected package type: expected {0}, actual response {1:#?}.")]
15InvalidServerResponse(&'static &'static str, Box<str>),
1617/// Server response with port = 0.
18#[error("Server response with port = 0.")]
19InvalidPort,
2021/// Server response with pid = 0.
22#[error("Server response with pid = 0.")]
23InvalidPid,
2425/// Server response with a different id than the requested one.
26#[error("Server response with a different id than the requested one.")]
27UnmatchedRequestId,
2829/// Server response with a different session_id.
30#[error("Server response with a different session_id.")]
31UnmatchedSessionId,
3233/// IO Error (Excluding `EWOULDBLOCK`): {0}.
34#[error("IO Error (Excluding `EWOULDBLOCK`): {0}.")]
35IOError(#[from] io::Error),
3637/// Failed to serialize/deserialize the message: {0}.
38#[error("Failed to serialize/deserialize the message: {0}.")]
39FormatError(#[from] SshFormatError),
4041/// Server refused the request: {0}.
42#[error("Server refused the request: {0}.")]
43RequestFailure(Box<str>),
4445/// Server refused the request due to insufficient permission: {0}.
46#[error("Server refused the request due to insufficient permission: {0}.")]
47PermissionDenied(Box<str>),
48}