Loading crates/s3s-fs/src/error.rs +3 −2 Original line number Diff line number Diff line use s3s::S3Error; use s3s::S3ErrorCode; use s3s::StdError; use std::panic::Location; Loading @@ -7,7 +8,7 @@ use tracing::error; #[derive(Debug)] pub struct Error { source: Box<dyn std::error::Error + Send + Sync + 'static>, source: StdError, } pub type Result<T = (), E = Error> = std::result::Result<T, E>; Loading @@ -15,7 +16,7 @@ pub type Result<T = (), E = Error> = std::result::Result<T, E>; impl Error { #[must_use] #[track_caller] pub fn new(source: Box<dyn std::error::Error + Send + Sync + 'static>) -> Self { pub fn new(source: StdError) -> Self { log(&*source); Self { source } } Loading crates/s3s-fs/src/utils.rs +3 −1 Original line number Diff line number Diff line use crate::error::*; use s3s::StdError; use tokio::io::AsyncWrite; use tokio::io::AsyncWriteExt; Loading @@ -10,7 +12,7 @@ use transform_stream::AsyncTryStream; pub async fn copy_bytes<S, W>(mut stream: S, writer: &mut W) -> Result<u64> where S: Stream<Item = Result<Bytes, Box<dyn std::error::Error + Send + Sync + 'static>>> + Unpin, S: Stream<Item = Result<Bytes, StdError>> + Unpin, W: AsyncWrite + Unpin, { let mut nwritten: u64 = 0; Loading crates/s3s/src/error/mod.rs +5 −3 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ use std::str::FromStr; use hyper::StatusCode; pub type StdError = Box<dyn std::error::Error + Send + Sync + 'static>; pub type S3Result<T = (), E = S3Error> = std::result::Result<T, E>; #[derive(Debug, thiserror::Error)] Loading @@ -23,7 +25,7 @@ struct Inner { // resource: Option<String>, request_id: Option<String>, status_code: Option<StatusCode>, source: Option<Box<dyn std::error::Error + Send + Sync + 'static>>, source: Option<StdError>, } impl S3Error { Loading @@ -47,7 +49,7 @@ impl S3Error { } #[must_use] pub fn with_source(code: S3ErrorCode, source: Box<dyn std::error::Error + Send + Sync + 'static>) -> Self { pub fn with_source(code: S3ErrorCode, source: StdError) -> Self { let mut this = Self::new(code); this.0.source = Some(source); this Loading @@ -65,7 +67,7 @@ impl S3Error { self.0.request_id = Some(val.into()); } pub fn set_source(&mut self, val: Box<dyn std::error::Error + Send + Sync + 'static>) { pub fn set_source(&mut self, val: StdError) { self.0.source = Some(val); } Loading Loading
crates/s3s-fs/src/error.rs +3 −2 Original line number Diff line number Diff line use s3s::S3Error; use s3s::S3ErrorCode; use s3s::StdError; use std::panic::Location; Loading @@ -7,7 +8,7 @@ use tracing::error; #[derive(Debug)] pub struct Error { source: Box<dyn std::error::Error + Send + Sync + 'static>, source: StdError, } pub type Result<T = (), E = Error> = std::result::Result<T, E>; Loading @@ -15,7 +16,7 @@ pub type Result<T = (), E = Error> = std::result::Result<T, E>; impl Error { #[must_use] #[track_caller] pub fn new(source: Box<dyn std::error::Error + Send + Sync + 'static>) -> Self { pub fn new(source: StdError) -> Self { log(&*source); Self { source } } Loading
crates/s3s-fs/src/utils.rs +3 −1 Original line number Diff line number Diff line use crate::error::*; use s3s::StdError; use tokio::io::AsyncWrite; use tokio::io::AsyncWriteExt; Loading @@ -10,7 +12,7 @@ use transform_stream::AsyncTryStream; pub async fn copy_bytes<S, W>(mut stream: S, writer: &mut W) -> Result<u64> where S: Stream<Item = Result<Bytes, Box<dyn std::error::Error + Send + Sync + 'static>>> + Unpin, S: Stream<Item = Result<Bytes, StdError>> + Unpin, W: AsyncWrite + Unpin, { let mut nwritten: u64 = 0; Loading
crates/s3s/src/error/mod.rs +5 −3 Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ use std::str::FromStr; use hyper::StatusCode; pub type StdError = Box<dyn std::error::Error + Send + Sync + 'static>; pub type S3Result<T = (), E = S3Error> = std::result::Result<T, E>; #[derive(Debug, thiserror::Error)] Loading @@ -23,7 +25,7 @@ struct Inner { // resource: Option<String>, request_id: Option<String>, status_code: Option<StatusCode>, source: Option<Box<dyn std::error::Error + Send + Sync + 'static>>, source: Option<StdError>, } impl S3Error { Loading @@ -47,7 +49,7 @@ impl S3Error { } #[must_use] pub fn with_source(code: S3ErrorCode, source: Box<dyn std::error::Error + Send + Sync + 'static>) -> Self { pub fn with_source(code: S3ErrorCode, source: StdError) -> Self { let mut this = Self::new(code); this.0.source = Some(source); this Loading @@ -65,7 +67,7 @@ impl S3Error { self.0.request_id = Some(val.into()); } pub fn set_source(&mut self, val: Box<dyn std::error::Error + Send + Sync + 'static>) { pub fn set_source(&mut self, val: StdError) { self.0.source = Some(val); } Loading