openssh-sftp-error-0.5.0/.cargo_vcs_info.json0000644000000001600000000000100146130ustar { "git": { "sha1": "6995b4a48ed0913cda1c9cb76df271db21f6e0bd" }, "path_in_vcs": "openssh-sftp-error" }openssh-sftp-error-0.5.0/CHANGELOG.md000064400000000000000000000011771046102023000152250ustar 00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ## [0.5.0](https://github.com/openssh-rust/openssh-sftp-client/compare/openssh-sftp-error-v0.4.0...openssh-sftp-error-v0.5.0) - 2024-08-10 ### Other - Update openssh requirement from 0.10.0 to 0.11.0 ([#138](https://github.com/openssh-rust/openssh-sftp-client/pull/138)) The changelog for this crate is kept in the project's Rust documentation in the changelog module. openssh-sftp-error-0.5.0/Cargo.toml0000644000000030500000000000100126120ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "openssh-sftp-error" version = "0.5.0" authors = ["Jiahao XU "] build = false autobins = false autoexamples = false autotests = false autobenches = false description = "Error type used when communicating with openssh sftp server." readme = false keywords = [ "ssh", "multiplex", "async", "network", "sftp", ] categories = [ "asynchronous", "network-programming", "api-bindings", ] license = "MIT" repository = "https://github.com/openssh-rust/openssh-sftp-client" resolver = "2" [package.metadata.docs.rs] features = ["openssh"] rustdoc-args = [ "--cfg", "docsrs", ] [lib] name = "openssh_sftp_error" path = "src/lib.rs" [dependencies.awaitable-error] version = "0.1.0" [dependencies.openssh] version = "0.11.0" optional = true default-features = false [dependencies.openssh-sftp-protocol-error] version = "0.1.0" [dependencies.ssh_format_error] version = "0.1.0" [dependencies.thiserror] version = "1.0.29" [dependencies.tokio] version = "1.11.0" features = ["rt"] [features] openssh = ["dep:openssh"] openssh-sftp-error-0.5.0/Cargo.toml.orig000064400000000000000000000014311046102023000162740ustar 00000000000000[package] name = "openssh-sftp-error" version = "0.5.0" edition = "2018" authors = ["Jiahao XU "] license = "MIT" description = "Error type used when communicating with openssh sftp server." repository = "https://github.com/openssh-rust/openssh-sftp-client" keywords = ["ssh", "multiplex", "async", "network", "sftp"] categories = ["asynchronous", "network-programming", "api-bindings"] [features] openssh = ["dep:openssh"] [package.metadata.docs.rs] features = ["openssh"] rustdoc-args = ["--cfg", "docsrs"] [dependencies] thiserror = "1.0.29" awaitable-error = "0.1.0" openssh-sftp-protocol-error = "0.1.0" ssh_format_error = "0.1.0" tokio = { version = "1.11.0", features = ["rt"] } openssh = { version = "0.11.0", default-features = false, optional = true } openssh-sftp-error-0.5.0/LICENSE000064400000000000000000000020521046102023000144120ustar 00000000000000MIT License Copyright (c) 2021 Jiahao XU Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. openssh-sftp-error-0.5.0/src/lib.rs000064400000000000000000000111371046102023000153140ustar 00000000000000#![forbid(unsafe_code)] use std::{io, num::TryFromIntError, process::ExitStatus}; pub use awaitable_error::Error as AwaitableError; pub use openssh_sftp_protocol_error::{ ErrMsg as SftpErrMsg, ErrorCode as SftpErrorKind, UnixTimeStampError, }; pub use ssh_format_error::Error as SshFormatError; use thiserror::Error as ThisError; /// Error returned by /// [`openssh-sftp-client-lowlevel`](https://docs.rs/openssh-sftp-client-lowlevel) /// and [`openssh-sftp-client`](https://docs.rs/openssh-sftp-client) #[non_exhaustive] #[derive(Debug, ThisError)] pub enum Error { /// Server speaks sftp protocol other than protocol 3. #[error("Server does not support sftp protocol v3: It only support sftp protocol newer than {version}.")] UnsupportedSftpProtocol { /// The minimal sftp protocol version the server supported. version: u32, }, /// Server returned a hello message that is too long. #[error("sftp server returned hello message of length {len}, which is longer than 4096.")] SftpServerHelloMsgTooLong { /// The length of the hello mesage len: u32, }, /// This error is meant to be a dummy error created by user of this crate /// to indicate that the sftp-server run on remote server failed. /// /// openssh-sftp-client would never return this error. #[error("sftp-server run on remote server failed: {0}.")] SftpServerFailure(ExitStatus), /// This error is meant to be a dummy error created by user of this crate /// to indicate that the sftp-server run on remote server failed. /// /// openssh-sftp-client would never return this error. #[error("Background task failed: {0}.")] BackgroundTaskFailure(&'static &'static str), /// This error is meant to be a dummy error created by user of this crate /// to indicate that the extension is not supported. /// /// openssh-sftp-client would never return this error. #[error("Unsupported extension {0}.")] UnsupportedExtension(&'static &'static str), /// IO Error (Excluding [`io::ErrorKind::WouldBlock`]): {0}. #[error("IO Error (Excluding `io::ErrorKind::WouldBlock`): {0}.")] IOError(#[from] io::Error), /// Failed to serialize/deserialize the message: {0}. #[error("Failed to serialize/deserialize the message: {0}.")] FormatError(#[from] SshFormatError), /// Error when waiting for response #[error("Error when waiting for response: {0}.")] AwaitableError(#[from] AwaitableError), /// Sftp protocol can only send and receive at most [`u32::MAX`] data in one request. #[error("Sftp protocol can only send and receive at most u32::MAX data in one request.")] BufferTooLong(#[from] TryFromIntError), /// The response id is invalid. /// /// The user can choose to log this error and continue operation. #[error("The response id {response_id} is invalid.")] InvalidResponseId { /// The invalid response id response_id: u32, }, /// Raised 2 errors when cleaning up. #[error(transparent)] RecursiveErrors(Box), /// Raised 3 errors when cleaning up. #[error(transparent)] RecursiveErrors3(Box), /// Sftp server error #[error("Sftp server reported error kind {0:#?}, msg: {1}")] SftpError(SftpErrorKind, SftpErrMsg), /// Invalid response from the sftp-server #[error("Response from sftp server is invalid: {0}")] InvalidResponse( // Use `&&str` since `&str` takes 16 bytes while `&str` only takes 8 bytes. &'static &'static str, ), /// Handle returned by server is longer than the limit 256 bytes specified in sftp v3. #[error("Handle returned by server is longer than the limit 256 bytes specified in sftp v3")] HandleTooLong, /// tokio join error #[error("Failed to join tokio task")] TaskJoinError(#[from] tokio::task::JoinError), #[cfg(feature = "openssh")] #[error("Failed to create sftp from session: {0}")] RemoteChildSpawnError(#[from] openssh::Error), } #[derive(Debug, ThisError)] #[error("OriginalError: {original_error}, curr err raised when cleaning up: {occuring_error}.")] pub struct RecursiveError { /// Original error pub original_error: Error, /// Current error raised when performing cleanup /// for original error. #[source] pub occuring_error: Error, } #[derive(Debug, ThisError)] #[error("err1: {err1}, err2: {err2}, err3: {err3}.")] pub struct RecursiveError3 { /// First error raised. pub err1: Error, /// Second error raised. pub err2: Error, /// Third error raised. #[source] pub err3: Error, }