Skip to content

Commit

Permalink
make the error type implement Send + Sync + 'static
Browse files Browse the repository at this point in the history
  • Loading branch information
irevoire committed Apr 16, 2024
1 parent cb32534 commit 6842f92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/cli-app-with-awc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ tokio = { version = "1.27.0", features = ["full"] }
yaup = "0.2.0"
tokio-util = { version = "0.7.10", features = ["full"] }
actix-rt = "2.9.0"
anyhow = "1.0.82"
8 changes: 4 additions & 4 deletions examples/cli-app-with-awc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ impl HttpClient for AwcClient {
.content_type(content_type)
.send_stream(stream)
.await
.map_err(|err| Error::Other(Box::new(err)))?
.map_err(|err| Error::Other(anyhow::anyhow!(err.to_string()).into()))?
} else {
request
.send()
.await
.map_err(|err| Error::Other(Box::new(err)))?
.map_err(|err| Error::Other(anyhow::anyhow!(err.to_string()).into()))?
};

let status = response.status().as_u16();
let mut body = String::from_utf8(
response
.body()
.await
.map_err(|err| Error::Other(Box::new(err)))?
.map_err(|err| Error::Other(anyhow::anyhow!(err.to_string()).into()))?
.to_vec(),
)
.map_err(|err| Error::Other(Box::new(err)))?;
.map_err(|err| Error::Other(anyhow::anyhow!(err.to_string()).into()))?;

if body.is_empty() {
body = "null".to_string();
Expand Down
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub enum Error {
InvalidUuid4Version,

#[error(transparent)]
Other(Box<dyn std::error::Error>),
Other(Box<dyn std::error::Error + Send + Sync + 'static>),
}

#[derive(Debug, Clone, Deserialize, Error)]
Expand Down

0 comments on commit 6842f92

Please sign in to comment.